[time-nuts] x86 CPU Timekeeping and clock generation

Poul-Henning Kamp phk at phk.freebsd.dk
Wed Jan 6 20:32:17 UTC 2021


--------
Tom Van Baak writes:

>If you do your kernel timekeeping in integers and modulus arithmetic you 
>are essentially doing cycle counting and the kernel will keep perfect 
>time relative to the external oscillator. So that should be the goal. 
>Not e-6, not e-9, not e-10, but perfect cycle counting. Consider this a 
>strong plea for someone in both BSD- and Linux- land to pull that off.

But not all of us have masers Tom :-)

Problem is, you still need fractions when NTP tells you that the
X-tal is 7.1PPM off frequency.

When I did timecounters, I tried a couple of things of the sort you
suggest, but when I benchmarked it, a single brutal 64 bit multiply
with a 32bit shift invariably ran faster, had more predictable
latency, worked with any frequency the hardware happened to have
and did NTP's bidding:

	http://phk.freebsd.dk/pubs/timecounter.pdf

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.




More information about the Time-nuts_lists.febo.com mailing list