October 2017
Intermediate to advanced
354 pages
9h 28m
English
This is a counter implemented in every x86 microprocessor by means of a 64-bit register called TSC the register. It counts the number of clock signals arriving on the CLK pin of the processor. The current counter value can be read by accessing the TSC register. The number of ticks counted per second can be calculated as 1/(clock frequency); for a 1 GHz clock it translates to once every nanosecond.
Knowing the duration between two consecutive ticks is very crucial. The fact that one processor clock's frequency might not be the same as others makes it vary across processors. CPU clock frequency is calculated during system boot by the calibrate_tsc() callback routine of the x86_platform_ops structure defined in the