On Mon, 26 Jan 2004, Steve Watt wrote:

> [EMAIL PROTECTED] wrote:
> >do what ping does (ping -f)
> >when you get an ENOBUFS do a usleep for 1 mSec.
> >and then send it again.
>
> So how, exactly, do you actually sleep for 1mSec?  I recently did some
> experiments using nanosleep(), and it seems that the minimum sleep time
> is 2 / HZ.  I.e. ask for 100nS, get 20mS (on a 10mS-ticking system).
>
> Mind you, that behavior is precisely aligned with what POSIX says should
> happen, since nanosleep() is not allowed to return success before the
> specified amount of time has expired, and you might be calling it 5nS
> before the clock tick.  But it does make doing correct Tx pacing a bit
> more challenging.

For what it's worth, when I tried this I wound up using gettimeofday
(IIRC) as a "macroscopic" clock and calculating nanosecond sleeps
between transmits; drift due to HZ was correctable because I knew the
average throughput I was after.

-- 
jan grant, ILRT, University of Bristol. http://www.ilrt.bris.ac.uk/
Tel +44(0)117 9287088 Fax +44 (0)117 9287112 http://ioctl.org/jan/
That which does not kill us goes straight to our thighs.
_______________________________________________
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to