[ntp:questions] Re: clock resolutions for different OS

Piotr Trojanek ptrojane at mion.elka.pw.edu.pl
Wed Aug 20 05:55:39 UTC 2003


In article <bhu3m2$vao$1 at cesium.transmeta.com>, H. Peter Anvin wrote:
>Most CPUs these days have a counter which counts individual core clock
>cycles.

True, but there still is a question, does OS support this hardware...
In example, NetBSD has microtime() routine in kernel. On i386
architecture (which includes modern CPU with TSC instruction) it
doesn't use core clock counter, and this routine is used both by NTP
syscalls and PPS timestamping.

Clock resolution is determined by running two microtime() (or
equivalent routines) one after another inside one syscall and
calculating the difference -- that haw it is done in Linux.

>At least on single-processor systems without aggressive power
>management (or where the power management compensates correctly) this
>is a very high quality high-precision clock.

It can be implemented also on SMP -- see "nanokernel" package with
reference code for that.

-- 
Piotr Trojanek



More information about the questions mailing list