Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 07 Aug 2001 00:35:58 -0700
From:      Terry Lambert <tlambert2@mindspring.com>
To:        Jeff Behl <jeff@expertcity.com>
Cc:        "'freebsd-hackers@freebsd.org'" <freebsd-hackers@FreeBSD.ORG>
Subject:   Re: timing question
Message-ID:  <3B6F9A5E.A58E9F31@mindspring.com>
References:  <0307F3737A2AD511A42200D0B7A071919A402F@dopey.corp.expertcity.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Jeff Behl wrote:
> please excuse and direct me to the right place if this isn't the appropriate
> place to post this sort of question....
> 
> we're looking into moving to freebsd (yea!), but found the following
> problem.  It seems that the shortest amount of time the below code will
> sleep for is 20 seconds!  any call to nanosleep for 5,10, etc miliseconds
> returns a 20 ms delay.  are we doing something wrong?

You appear to be measuring the quantum.

You can decrease the quantum size via sysctl, or at compile
time.

Realize that your timing is tight enough that if you are
running any other code, you can't expect that your process
will get the quantum next, unless you use rtprio.

Also note that your timer granularity might be someone less
than you would expect: in other words it could be returning
before, but since the sleep is woken up as the result of
a timer interrupt firing, you may need to increase the rate
your clock runs at (search for "HZ" in /sys/i386/conf/LINT)
to make your timer interrupts faster, which will in turn
increase your timeout resolution.

-- Terry

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?3B6F9A5E.A58E9F31>