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.