I used to benchmark Linux System Calls with rdtsc to get the counter difference before and after the system call. I interpreted the result as wall clock timer since TSC increments at constant rate and does not stop when entering halt state.
The Invariant TSC concept is described as
The invariant TSC will run at a constant rate in all ACPI P-, C-. and T-states.
Can a constant non-invariant tsc change frequency when changing state from C0 (operating) to C1 (halted)?
My current view is that it cannot change frequency only across Performance(P) states. So applying rdtsc to get wall clock timer for system calls is not reliable when using non-invariant tsc.
I did not find invariant tsc flag in my /proc/cpuinfo
, only constant_tsc
meaning that it is not necessary invariant.
The source of confusion is the sentence from Intel System Programming manual:
The time stamp counter in newer processors may support an enhancement, referred to as invariant TSC.
So some chips (including mine) have constant, but not invariant tsc.
constant_tsc
processor built? Do you care about prehistoric processors? – Magnessconstant_tsc
. But havingconstant_tsc
does not mean havinginvariant_tsc
. – Freefloating/proc/cpuinfo
:tsc
,constant_tsc
,nonstop_tsc
,tsc_known_freq
,tsc_deadline_timer
,tsc_adjust
. No "invariant", but maybe it's the "known frequency"? – Magnesscpuid
,eax = 0x80000008
(a leaf to determine if tsc is invariant) and got the resulting content ofedx
as0b100000000
(8th bit stands for enabledinvariant_tsc
). So my chip actually supportsinvariant_tsc
which was not clear from/proc/cpuinfo
output. – Freefloatingconstant_tsc
andnonstop_tsc
– Fomentationconstant_tsc
on an old Core 2 system I have, for example. Even though it is nonstop and synced between cores. – Caisson