kqueue + EVFILT_TIMER unreliable timing problems

Steven Ayre steveayre at gmail.com
Thu Jul 7 10:37:02 UTC 2011


Hi everyone,

I'm trying to use kqueue with EVFILT_TIMER to create an interval timer.
However, I'm getting very unreliable results.

The code for a test case is at: http://pastebin.com/ratK0AXL

I'm finding that regardless of the number of ticks I wait for, it takes
around 50% longer than it should.

For a 20ms interval, 200 ticks takes 6s not 4s, 2000 takes 60s not 40s.

I am running FreeBSD within a virtualbox VM (Windows host, no load) so I
know timing may not be as reliable as if I was on the bare metal, but this
still much higher than expected.

-Steve


More information about the freebsd-questions mailing list