Netgraph, usleep, and moving to Kernel
sandiegobiker at gmail.com
Sun Feb 3 14:10:24 PST 2008
I've had some good success with implementing a custom MAC protocol using
Netgraph. The current implementation runs in userland, connects to the
Kernel iface and kernel ethernet nodes. It uses a polling loop with
usleep, All very cool. This is just background as the question really has
to do with usleeop in userland or kernel mode.
In testing with nothing else running on the box. it seems to reveal that if
I ask for 100 usec of "sleep time," I get about 1000 usec (1 msec). I have
set hz to 10,000 in kern.clockrate and Ticks is at 100.
If I set hz to 20,000 there is no improvement and Ticks seems to "reset
itsefl" to 50. Box is an old Pentium with about 500 Mhz clock. I also get
this behaviour on "test programs" that just call usleep.
1) Is there a way to get finer timing with usleep or an equivalent call?
2) When I move the userland into a "true" Netgraph Kernel node will I see
Thanks in advance.
More information about the freebsd-hackers