Re: [PATCH] calculate fudge on win32

2011-06-02 Thread Alexey Borzenkov
On Thu, Jun 2, 2011 at 5:10 AM, Marc Lehmann schm...@schmorp.de wrote: On Thu, Jun 02, 2011 at 01:55:43AM +0400, Alexey Borzenkov sna...@gmail.com wrote: This patch works around the problem with some ev_timer timeout values causing extreme cpu load on win32, that at the moment is observed at

Re: [PATCH] calculate fudge on win32

2011-06-02 Thread Marc Lehmann
On Thu, Jun 02, 2011 at 10:25:56AM +0400, Alexey Borzenkov sna...@gmail.com wrote: fudge = 1e-6: with ev_io: prepare called 128 times without ev_io: prepare called 1765445 times Right, I forgot about sleep - I guess that can be specialcased though, so 1e-6 it is then. Thanks for trying it

Re: [PATCH] calculate fudge on win32

2011-06-02 Thread Marc Lehmann
On Thu, Jun 02, 2011 at 09:51:13PM +0200, Denis Bilenko denis.bile...@gmail.com wrote: + backend_fudge = 1e-3; This helps with CPU load but it still causes ev_timer(0) to issue ev_sleep(0) which puts the process to sleep. As it should, see below. However, for ev_timer with AT = 0,

updating timers safely

2011-06-02 Thread Juan Pablo L
Hi, i need to disconnect a socket after some time of inactivity, i m not sure how to do that in an optimum way( according to the docs stopping/starting every time is not optimum) and safely (so updating the repeat member from a different thread while the socket is being under the control of the

Re: [PATCH] calculate fudge on win32

2011-06-02 Thread Marc Lehmann
On Thu, Jun 02, 2011 at 10:25:56AM +0400, Alexey Borzenkov sna...@gmail.com wrote: Which is also why calculating fudge the way I did is meaningless, because if it happens to be smaller than 1e-3 it would fold into Sleep(0), and remember that by my calculations on Windows 7 ev_time resolution

Re: updating timers safely

2011-06-02 Thread Marc Lehmann
On Thu, Jun 02, 2011 at 04:59:22PM -0600, Juan Pablo L jpablolorenze...@gmail.com wrote: Any tip would be appreciated on how to deal with this situation, maybe You claim to have read the documentation but managed to miss the Be smart about timeouts section? i may have thousands if not

Re: updating timers safely

2011-06-02 Thread Juan Pablo L
thanks for your reply, actually yes i have read the part about the Be smart about timer, but this is the first time i have to manage so many timers, and something is not clear to me. #4 refers to making a linked list and putting all timers in there but how can i control individually each timer,

Re: updating timers safely

2011-06-02 Thread Brandon Black
On Thu, Jun 2, 2011 at 9:08 PM, Juan Pablo L jpablolorenze...@gmail.com wrote: thanks for your reply, actually yes i have read the part about the Be smart about timer, but this is the first time i have to manage so many timers, and something is not clear to me. #4 refers to making a linked

Re: updating timers safely

2011-06-02 Thread Juan Pablo L
Thanks a lot, that is a bit clearer, so the event loop will always be controlling the first timer only, which is supposed to be the closest to expiration (and some few next nodes) right ? i m trying to avoid using start/stop or even ev_timer_again because the socket is considered busy when taken

Re: updating timers safely

2011-06-02 Thread Brandon Black
On Thu, Jun 2, 2011 at 10:15 PM, Juan Pablo L jpablolorenze...@gmail.com wrote: i m trying to avoid using start/stop or even ev_timer_again because the socket is considered busy when taken by a thread and thread will hold the socket for as long as clients have something to send which could be a

[PATCH] calculate fudge on win32

2011-06-02 Thread Denis Bilenko
On Fri, Jun 3, 2011 at 12:34 AM, Marc Lehmann schm...@schmorp.de wrote: As for 0, we indeed don't need to care, but introducing this special case would make the timeout values nonproportional to the actual time. And that in turn would destroy the property that adding something to a timeout