Thanks for all help.
On Thursday, 28 May 2015 at 02:00:57 UTC, zhmt wrote:
I think it is not problem of gc, it is my fault:
The operations is serialized:
clent send - server recv - server send - client recv,
so if one operation takes too long time, the throughput will
definitely fall down.
I cant explain why
On Wednesday, 27 May 2015 at 09:39:42 UTC, Anonymouse wrote:
On Wednesday, 27 May 2015 at 08:42:01 UTC, zhmt wrote:
When I enable the --profle, get something like this, it doesnt
give me too much help:
[...]
Tried callgrind and kcachegrind? If nothing else it's better at
illustrating the
When I enable the --profle, get something like this, it doesnt
give me too much help:
Timer Is 3579545 Ticks/Sec, Times are in Microsecs
Num TreeFuncPer
CallsTimeTimeCall
1298756 4996649885 49875773773840
@jklp
And also you could try to surround the whole block with
`GC.disable` and `GC.enable`. This would help to determine if
the GC is involved:
---
Ptr!Conn conn = connect(127.0.0.1,8881);
GC.disable;
ubyte[100] buf;
string str;
for(int i=0; iN; i++)
{
str = format(%s,i);
What happened when the code changes a little? Who will give an
explaination,Thanks a lot?
what happend if you use sformat instead?
Ptr!Conn conn = connect(127.0.0.1,8881);
ubyte[100] buf;
char[100] buf2;
for(int i=0; iN; i++)
{
auto str = sformat(buf2, %s,i);
If I pass a timeout with 1ms to epoll_wait,the cpu will not be
busy when throughput falls down.
It seems that dlang library is not so effient?
On Wednesday, 27 May 2015 at 05:51:21 UTC, zhmt wrote:
I noticed that the cpu% falls from 99% down to 4% as well when
the throughput falls down.
I tried again for several times, the cpu is still busy, 98.9%.
I think it is not problem of gc, it is my fault:
The operations is serialized:
clent send - server recv - server send - client recv,
so if one operation takes too long time, the throughput will
definitely fall down.
I cant explain why it so fast when buffer is big enough, and so
low when
On Wednesday, 27 May 2015 at 19:04:53 UTC, Márcio Martins wrote:
On Wednesday, 27 May 2015 at 05:48:13 UTC, zhmt wrote:
The code you posted is the client code, but the issue seems to
be on the server side.
Can you post the server code and also the timing code?
@Márcio Martins
here is
I am writing a echoclient, as below:
Ptr!Conn conn = connect(127.0.0.1,8881);
ubyte[100] buf;
for(int i=0; iN; i++)
{
scope string str = format(%s,i);
conn.write((cast(ubyte*)str.ptr)[0..str.length]);
conn.read(buf[0..str.length]);
n++;
}
conn.close();
When it
I noticed that the cpu% falls from 99% down to 4% as well when
the throughput falls down.
Finally,I got the dmd command line as below:
dmd -c
-of.dub/build/application-debug-linux.posix-x86_64-dmd_2067-3E65324D543ED19695028F22620736D3/ezsock.o
-debug -g -w -version=Have_ezsock -version=Have_gamelibd
-Isource/ -I../gamelibd/source/ -Jviews source/app.d ..
And try to remove
On Thursday, 30 April 2015 at 12:31:54 UTC, wobbles wrote:
On Thursday, 30 April 2015 at 03:00:36 UTC, zhmt wrote:
On Thursday, 30 April 2015 at 02:02:50 UTC, zhmt wrote:
dub build is running on centos7. It works well until today,
It becomes very slow suddenly. It will take minuties per
mono-d is running on centos7 with options below:
first:
{
name: ezsock,
targetType: executable,
description: A minimal D application.,
copyright: Copyright © 2015, zhmt,
authors: [zhmt],
mainSourceFile: source/app.d,
dependencies: {
dub build is running on centos7. It works well until today, It
becomes very slow suddenly. It will take minuties per
compilation, there is 10 files in project.
Has anyone experienced this?
On Thursday, 30 April 2015 at 02:02:50 UTC, zhmt wrote:
dub build is running on centos7. It works well until today, It
becomes very slow suddenly. It will take minuties per
compilation, there is 10 files in project.
Has anyone experienced this?
It is because:
The dub will connect to some
On Tuesday, 24 March 2015 at 12:25:14 UTC, Etienne wrote:
On 3/24/2015 5:50 AM, zhmt wrote:
I am using kqueue on macosx, I know how to write a simple
server. But
don't know which event will be triggered in kqueue when
connected
successfully , which event when failed?
EVFILT_READ or
I am using kqueue on macosx, I know how to write a simple server.
But don't know which event will be triggered in kqueue when
connected successfully , which event when failed?
EVFILT_READ or EVFILT_WRITE?
I have googled this question, got no examples, any suggestions
are welcome, Thanks.
On Friday, 13 March 2015 at 06:39:31 UTC, Rikki Cattermole wrote:
On 13/03/2015 7:35 p.m., zhmt wrote:
ubyte[] arr ;
I pass the arr.ptr to c program, it fails silently.
Is there any way to cast a ubyte[] to a clang pointer?
Theoretically this should work.
D:
void func(ubyte[] value) {
ubyte[] arr ;
I pass the arr.ptr to c program, it fails silently.
Is there any way to cast a ubyte[] to a clang pointer?
I have some source code of vibe.d, it does this in the same way,
and it works .
void read(ubyte[] dst)
{
checkConnected(false);
acquireReader();
scope(exit) releaseReader();
while (dst.length 0) {
On Friday, 13 March 2015 at 06:56:33 UTC, Ali Çehreli wrote:
On 03/12/2015 11:35 PM, zhmt wrote:
ubyte[] arr ;
I pass the arr.ptr to c program
Unless there is sentinel value at the end of the array, you
must also pass the number of elements (as Rikki Cattermole has
shown).
However, if
I have two dub projects, one is library, the other one is app.
The library is referenced by the app. How to reference it in
dub.json?
I found the subPackage, It does not meet my needs exactly.
On Friday, 13 March 2015 at 08:24:11 UTC, zhmt wrote:
I have two dub projects, one is library, the other one is app.
The library is referenced by the app. How to reference it in
dub.json?
I found the subPackage, It does not meet my needs exactly.
I got it:
dependencies: {
I want to know how to locate the position of crashing in dlang?
for example: there is stack dump in c, exception stack in java,
they could help to locate the root of problems.
I posted in vibe.d forum, no one replied . Help me please:
http://forum.rejectedsoftware.com/groups/rejectedsoftware.vibed/thread/24458/
I developed a socks5 proxy server with vibe.d.
but it crashed after running a few minutes, with the output below:
Task terminated with uncaught exception: Operating on closed
TCPConnection.
Task terminated with uncaught exception: Operating on closed
TCPConnection.
Task terminated with
On Wednesday, 11 March 2015 at 10:13:12 UTC, Théo Bueno wrote:
On Wednesday, 11 March 2015 at 08:16:17 UTC, zhmt wrote:
Now , my question is:
How to get the position it crashes?
Or get the method call stack?
If you are developing under Linux, you can use GDB to debug
your D apps, just like
On Wednesday, 11 March 2015 at 11:09:42 UTC, Daniel Kozák wrote:
On Wed, 11 Mar 2015 10:05:39 +
zhmt via Digitalmars-d-learn
digitalmars-d-learn@puremagic.com wrote:
I want to know how to locate the position of crashing in dlang?
for example: there is stack dump in c, exception stack
On Wednesday, 11 March 2015 at 08:16:17 UTC, zhmt wrote:
I developed a socks5 proxy server with vibe.d.
but it crashed after running a few minutes, with the output
below:
Task terminated with uncaught exception: Operating on closed
TCPConnection.
Task terminated with uncaught exception:
On Wednesday, 11 March 2015 at 10:13:12 UTC, Théo Bueno wrote:
On Wednesday, 11 March 2015 at 08:16:17 UTC, zhmt wrote:
Now , my question is:
How to get the position it crashes?
Or get the method call stack?
If you are developing under Linux, you can use GDB to debug
your D apps, just like
On Sunday, 8 March 2015 at 13:56:37 UTC, Kagamin wrote:
On Sunday, 8 March 2015 at 03:09:00 UTC, zhmt wrote:
Yes, this a good idea, if the author of vibe.d do this, will
be better, it is used frequently in many scenes.
You can do it too, unlike in C++, in D you can write extension
methods to
On Saturday, 7 March 2015 at 09:39:42 UTC, Kagamin wrote:
On Saturday, 7 March 2015 at 02:23:10 UTC, zhmt wrote:
Hi,I got the right answer in vibe.d forum,here is the link:
http://forum.rejectedsoftware.com/groups/rejectedsoftware.vibed/thread/24403/#post-24416
If that's correct, you can
Hi,I got the right answer in vibe.d forum,here is the link:
http://forum.rejectedsoftware.com/groups/rejectedsoftware.vibed/thread/24403/#post-24416
TCPConnecion has a read method, which will block untill the buf
is fully filled.
This is not what I want.
I want a readSome method, which will return if some data comes
from remote end, and notify the length of data to me. so I can
process data in time.
what should I do ?
There should be a function called DataAvilable.
Simply read the data if this function returns true
Thanks you!
But the DataAvilable just return a bool value, so I dont know the
available data size, I cant call the read method simply.
Is there more info to solve this problem?
On Friday, 6 March 2015 at 09:30:51 UTC, ketmar wrote:
On Fri, 06 Mar 2015 01:19:40 +, zhmt wrote:
Thanks for all the suggestions and pointing the right
direction,I will
learn and try vibe.d, try to use it in my gameserver.
i've seen people using vibe.d to write warcraft server, so it's
I am forwarding data from client to another server, if the client
send data to server,I want to forward that to another server in
time.
So, if the server recieves nothing it will wait, if it receive
some data , forward them to another server immediately.
I dont think the TCPConnecion.read
Take a look at empty and leastSize.
https://github.com/rejectedsoftware/vibe.d/blob/master/source/vibe/core/stream.d#L33
@Rikki Cattermole
Thanks for your reply, but it is not what I want, and I cant
implement my goal with them.
in boost::asio, It has a method like this :
On Friday, 6 March 2015 at 20:03:52 UTC, Ola Fosheim Grøstad
wrote:
On Friday, 6 March 2015 at 19:33:56 UTC, zhmt wrote:
On Friday, 6 March 2015 at 18:40:28 UTC, Kagamin wrote:
I'd say, peek is the right method, it returns what's already
in the buffer (but doesn't read), while leastSize
On Friday, 6 March 2015 at 18:40:28 UTC, Kagamin wrote:
I'd say, peek is the right method, it returns what's already in
the buffer (but doesn't read), while leastSize returns full
logical size of the stream.
The api of vibe.d is too simple to use in real work.
On Thursday, 5 March 2015 at 08:22:33 UTC, Jack Applegame wrote:
On Thursday, 5 March 2015 at 06:05:56 UTC, zhmt wrote:
I am a gameserver developer, my programming lang is java now.
I want to change java to dlang, and I like boost_asio and it's
coroutine,
so, I want to create a binding of
On Thursday, 5 March 2015 at 09:42:53 UTC, Kagamin wrote:
string s;
char[] b = cast(char[])asArray();
b[0..s.length] = s[];
Thank you very much. I should stop my developing , and read the
dlang tutorial again.
Thanks for all the suggestions and pointing the right direction,I
will learn and try vibe.d, try to use it in my gameserver.
I am writing a asio binding. Objects need to be serialized into a
buffer (void *),
for example, write utf8 string into buffer,
write int into buffer,
write long into buffer,
Here is my class
class Buffer
{
private void *ptr;
private int size;
private int _cap;
I am a gameserver developer, my programming lang is java now.
I want to change java to dlang, and I like boost_asio and it's
coroutine,
so, I want to create a binding of boost_asio.
But I am not familiar with dlang, so I want to find someone help
me, or develope this binding with me.
I
how to update table schema automatically:
this()
{
mdb = new MysqlDB(connStr);
auto conn = mdb.lockConnection();
scope(exit) conn.close();
MysqlOrmUtil.updateTableSchema!(Customer)(conn);
here is how to use:
@UniqueIndex(id,[id])
class Card
{
@NotNull()
@Auto()
long id;
string pwd;
long agentId;
bool valid;
long rmb;
long createDate;
long soldDate;
long chargeDate;
}
public Card[]
finally ,I write a orm tool to replace hibernated, it is simple,
and it is easy to use, and every thing in control.
It is free to copy ,improve.
module mysqlormutil;
import vibe.d;
import std.stdio;
import mysql.connection;
import mysql.db;
struct NotNull
{
}
struct Auto
{
}
struct
I have submit an issue on github, hope that the author could help
me.
class Card
{
import hibernated.core;
@Id
@Generated
long id;
@UniqueKey
string pwd;
}
MySQLDriver driver = new MySQLDriver();
string url = MySQLDriver.generateUrl(10.211.55.10, 3306,
test);
string[string] params =
The app compiles fine, but It throw an exception when I try to
save data to mysql :
hibernated.type.MappingException@../../../zhmt/.dub/packages/hibernated-0.2.19/source/hibernated/metadata.d(3332):
Cannot find entity by class ezsockacount.Dao.Customer
My initialization code is something
Hi,Arjan,Thx for your replies, I have tried your suggestion,
MySQLDriver driver = new MySQLDriver();
string url = MySQLDriver.generateUrl(10.211.55.10, 3306,
test);
string[string] params = MySQLDriver.setUserAndPassword(root,
xxx);
auto ds = new
The behavior of array is more or less unpredictable.
If it is always a reference like class , it will be more
predictable.
Sorry, I misunderstand the meaning of array pointer, it is not
equals to arr.ptr.
The array pointer meets my need perfectly .
Ignore my replies above, Sorry!!!
Will arr.ptr change in the future?
As the array add more members , it need more memroy, then
remalloc may be called, the pointer maybe change, then the stored
pointer will be invalid.
Will this happen?
On Thursday, 5 February 2015 at 08:58:47 UTC, bearophile wrote:
zhmt:
Will arr.ptr change in the future?
As the array add more members , it need more memroy, then
remalloc may be called, the pointer maybe change, then the
stored pointer will be invalid.
Will this happen?
Yes, it can
On Thursday, 5 February 2015 at 10:12:47 UTC, wrote:
On Thursday, 5 February 2015 at 06:58:09 UTC, Ali Çehreli wrote:
On 02/04/2015 10:42 PM, zhmt wrote:
Here is a simple code snippet:
With this approach, the allocation of `arr` itself is often
clumsy and error-prone. In this case it is
void test(ref int[] arr) {
arr ~= 4;
}
It is something like ref variables. But ref just be used in
function declaration.
@Ali
I know the direction now, I should learn more about the pointers.
Thx very much.
Here is a simple code snippet:
class A {
public int[] arr;
}
class B {
public int[] arr;
}
void main()
{
int[] arr;
A a = new A;
B b = new B;
a.arr = arr;
b.arr = arr;
arr ~= 1;
arr ~= -2;
foreach(data; a.arr)
Anybody help?
void getT(SRC,DEST)(SRC src,DEST dest)
{
foreach (i, type; typeof(SRC.tupleof)) {
string name = SRC.tupleof[i].stringof;
__traits(getMember, dest, name) = __traits(getMember, src,
name);
writeln(name);
}
}
when I write the code above, the
I have a struct created by thrift:
struct Card {
long id;
string pwd;
long agentId;
bool valid;
long rmb;
long createDate;
long soldDate;
long chargeDate;
mixin TStructHelpers!([
TFieldMeta(`id`, 1, TReq.OPTIONAL),
TFieldMeta(`pwd`, 2, TReq.OPTIONAL),
On Wednesday, 28 January 2015 at 10:16:02 UTC, Fyodor Ustinov
wrote:
Hi!
Simple program:
import std.variant;
shared Variant[string] t;
void main() {
t[t] = bebebe;
}
Without shared this program compiles and works.
With shared I get:
aa.d(6): Error: template
On Wednesday, 28 January 2015 at 10:32:56 UTC, Fyodor Ustinov
wrote:
On Wednesday, 28 January 2015 at 10:20:42 UTC, zhmt wrote:
try __gshared
It seems to me - is not the solution, it's a hack. I want to
understand what the happening. :)
I am new to D. But I that error yesterday, and it's
The final version works well:
void copyObj(SRC,DEST)(ref SRC src,ref DEST dest)
{
foreach (i, type; typeof(SRC.tupleof)) {
__traits(getMember, dest, SRC.tupleof[i].stringof) =
__traits(getMember, src, SRC.tupleof[i].stringof);
}
}
thank u , @Marc Schütz .
Thx very much for all the help, I will try.
On Wednesday, 28 January 2015 at 14:59:52 UTC, Ali Çehreli wrote:
name must be 'enum':
On 01/28/2015 06:34 AM, zhmt wrote:
void getT(SRC,DEST)(SRC src,DEST dest)
{
foreach (i, type; typeof(SRC.tupleof)) {
string name = SRC.tupleof[i].stringof;
enum name =
On Wednesday, 28 January 2015 at 23:34:10 UTC, Chris Williams
wrote:
On Wednesday, 28 January 2015 at 09:44:29 UTC, zhmt wrote:
Sometime , I need to copy them:
thrift.Card tc;
db.Card dc;
dc.id = tc.id;
dc.pwd = tc.pwd;
...
It is boring coding, I want a solution to copy them
sorry , I am quite new to dlang.
I resovled it by Generic programming :
private const (ubyte)[] serialObj(T) (T obj)
{
TMemoryBuffer trans = new TMemoryBuffer();
auto prot = new TCompactProtocol!TMemoryBuffer(trans);
obj.write(prot);
return
I am writing code below:
private Cmd deserialCmd(ubyte[] data)
{
Cmd ret;
TMemoryBuffer trans = new TMemoryBuffer(data);
auto prot = new TCompactProtocol!TMemoryBuffer(trans);
ret.read(prot);
return ret;
75 matches
Mail list logo