[time-nuts] x86 CPU Timekeeping and clock generation

Hal Murray hmurray at megapathdsl.net
Thu Jan 7 00:51:49 UTC 2021


tholmes at woh.rr.com said:
> Thanks to Chris, Magnus, and Trent for clearing things up. Never would have
> expected going to the effort of putting in a cheap clock, only to use it very
> little.  

The frequency of your clock determines the granularity of a simple/quick 
read-the-clock operation.

If you have a TSC and use it for timekeeping, you can easily get ns level 
results quickly and cleanly.

With something like a RTC/TOY/CMOS clock you get much reduced granularity.  
The basic clock is only good to a second.  Most of them had some mechanism to 
generate an interrupt every N ms.  That was long used by the scheduler and for 
timekeeping.  Then somebody used the TSC to interpolate between scheduler 
ticks.  Then somebody did all the timekeeping from the TSC.

Many years ago, I was graphing  ntpd's drift vs temperature.  I thought the 
kernel was using the TSC for timekeeping.  My graphs got much cleaner when I 
moved the temperature probe from the CPU crystal over to the CMOS clock 
crystal.  Many years ago.


-- 
These are my opinions.  I hate spam.







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