On Thu, Feb 16, 2006 at 09:56:30AM +0100, Balazs Scheidler wrote:
On Wed, 2006-02-15 at 14:28 -0500, John Morrissey wrote:
FWIW, I modified syslog-ng 1.6.9 to usleep(10000) at the end of the io_iter() loop in src/main.c. This dropped CPU consumption by about fourfold - instead of spinning in that io_iter() loop, reading one or two messages per poll(), it's now reading several (3-15) messages per poll().
The idea is cool, although I have to admit it is really a hack :)
This might be useful to others as well. I will probably add it as a global option. Thanks for tracking this down.
I pulled the time_sleep() changes from a recent snapshot (thanks!) and am backporting them to 1.6.x[1]. I noticed this hunk: + if (backend->configuration->time_sleep > 0) + { + struct timespec ts; + + ts.tv_sec = 0; + ts.tv_nsec = backend->configuration->time_sleep * 1000; + + nanosleep(&ts, NULL); The docs say the time_sleep() value is in milliseconds, but 1 msec == 1 000 000 nsec - shouldn't this multiplication factor have an extra three zeros? :-) john [1] http://horde.net/~jwm/software/misc/10_configurable_sleep.diff -- John Morrissey _o /\ ---- __o jwm@horde.net _-< \_ / \ ---- < \, www.horde.net/ __(_)/_(_)________/ \_______(_) /_(_)__