Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 01 Apr 1997 17:00:19 -0500
From:      "Louis A. Mamakos" <louie@TransSys.COM>
To:        gbeach@cybernet.com
Cc:        hackers@freebsd.org
Subject:   Re: Internal clock 
Message-ID:  <199704012200.RAA03711@whizzo.transsys.com>
In-Reply-To: Your message of "Tue, 01 Apr 1997 09:11:18 %2B0100." <3340C326.6150@cybernet.com> 
References:  <3340C326.6150@cybernet.com> 

next in thread | previous in thread | raw e-mail | index | archive | help
> How can I make time measurements in increments smaller than the clock
> tick?  Specifically, I am running BSD on a Pentium PC which has 128
> clock ticks per second.  Is there any way to improve the resolution?

The gettimeofday() system call has resolution finer than the 128hz tick
rate.  If you look at the microtime subroutine in /sys/i386/i386/microtime.s,
you'll see some pretty scary code which does this.  On non-586/686 cpus,
it looks at the counter which fires the 128hz interrupt to see how far along
it is since the last interrupt, and uses that to compute the "current"
time.  The 586/686 case is somewhat more interesting..

The xntpd daemon uses this feature to synchronize the system clock to within
a very few milliseconds by timestamping the arrival of packets delivered.

As others have mentioned, arranging to wakeup at some arbitrary time in
the future is a different thing all together.  I think that the scheduling
events are either based on the 128hz clock tick, or some other process
blocking.

louie





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