November 17, 2017 Re: NIO+Multithreaded TCPSocket listener, very low cpu utilisation | ||||
---|---|---|---|---|
| ||||
Posted in reply to kdevel | On Friday, 17 November 2017 at 14:28:38 UTC, kdevel wrote: > On Thursday, 16 November 2017 at 19:37:31 UTC, ade90036 wrote: >> Can we enable some sort of profiling to see what is going on? > > You may compile the code with dmd -g -O -profile -profile=gc > > I currently struggle getting meaningful output. I want to terminate the program after a number (say 400) handled requests. When returning from main the program hangs, so I call exit. This works: ``` if (++accept_cnt > 400) { writeln ("returning"); taskPool.stop; return; } ``` > I see the invocations [of the socket allocation wrapper] in handle_socket in > the console but not in trace.log. Now they are in trace.log. Also I see this: --- Num Tree Func Per Calls Time Time Call [...] 399 14948526 11824366 29635 void httpdtasks.handle_socket(std.socket.Socket) --- 30 milliseconds for handle_socket while the client side (Firefox) reports <= 1 ms. What does this mean? There is another point that bothers me: In each handle_socket invocation a new SocketSet is created. How can this allocation be done once per thread (thread local storage)? |
Copyright © 1999-2021 by the D Language Foundation