Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 2 Dec 2002 11:49:03 -0600 (CST)
From:      Mike Silbersack <silby@silby.com>
To:        Stijn Hoop <stijn@win.tue.nl>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: [nephtes@openface.ca: [Xmame] Use of usleep() with -sleepidle]
Message-ID:  <20021202114019.R31106-100000@patrocles.silby.com>
In-Reply-To: <20021202151816.GJ83264@pcwin002.win.tue.nl>
References:  <20021202151816.GJ83264@pcwin002.win.tue.nl>

next in thread | previous in thread | raw e-mail | index | archive | help

On Mon, 2 Dec 2002, Stijn Hoop wrote:

> Hi,
>
> Summary: this is going to be a rather long email about the timing of various
> _sleep functions, compared to the same on Linux.
>
> I ran across this at the xmame mailing list, and I have seen some
> interesting results.

> One had an Athlon 1400XP, and got the following for the select speeds:
>
> %%%
> Testing _select_sleep (x 1000), delay 8
> Total time: 9999.906000 ms; unit time: 9.999906 ms; estimated overhead: 1.999906 ms
> %%%

> What's going on here? Is our select really that much slower, or is the program
> measuring the wrong values, or doesn't this speed make a difference in
> 'real-world' applications, or what?
>
> --Stijn

The time select() takes should be directly related to your system's hz
setting.  The default for FreeBSD is 100, which means that the interrupt
timer will fire every 10ms.  If you want to play with that, edit
/etc/sysctl.conf and set kern.hz="1000", which should give you 1 ms
accuracy.

As to why Linux may appear "better"... I believe that Linux defaults to
hz=100, but that the default switched to hz=1000 sometime in the recent
past.

To answer your final question:  Sleep accuracy doesn't matter to most
applications, but I'm sure counterexamples could be found.

Mike "Silby" Silbersack

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021202114019.R31106-100000>