Re: Sleeping in nanos
Re: Sleeping in nanos
- Subject: Re: Sleeping in nanos
- From: Colin Hirsch <email@hidden>
- Date: Sat, 3 Feb 2007 16:21:11 +0100
On Sat, Feb 03, 2007 at 03:24:15AM -0500, Ed Wynne wrote:
>
> On Feb 3, 2007, at 3:03 AM, Jan Brittenson wrote:
> >Greg wrote:
> >>So then why do I barely see 1% CPU utilization on linux?
> >But how accurate is it? When I last dealt with this a few years
> >ago, nanosleep
> >always slept at least 10ms on Linux. Some quick googling shows
> >this still seems
> >to be the case.
>
> I assume you ment 10us?
10 milliseconds is quite feasible, corrresponds to a timer tick
of 100 Hz, which is quite common... Quick test on a 2.4.18 box
gives me the following; seems to be running 50 Hz (or is under
some load):
colin:~$ cat t.cc
#include <time.h>
int main( int argc, char ** argv )
{
timespec t = { 0, 1 };
for ( unsigned i = 0; i < 100; ++i )
::nanosleep( & t, 0 );
return 0;
}
colin:~$ g++ -O t.cc
colin:~$ time ./a.out
real 0m2.002s
user 0m0.000s
sys 0m0.010s
Regards, Colin
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden