rdtsc delta to nanosecond conversion

34 views Asked by At

Recently, I have been trying to run some performance anlaysis on my program. I want to measure the latency of some functions in cpu ticks and later convert the delta to nanosecond. (I intentionally am not using std::chrono::system_clock::now for direct nanosecond mesaure, so let's set that discussion aside.)

In order to get the CPU frequency, (Intel(R) Core(TM) i9-10980XE), I run get_tsc_freq_arch(). And it shows 3GHz - which is the same number I see from lscpu. However, the machine is actually running overclocked, which is at ~5GHz.

In this case, is it right to assume that each tick is 1/3G? or 1/5G? My intuition says 1/5G, but I was told to use 1/3G and I'd like to learn the reason.

Always many thanks to stackoverflow gurus!

0

There are 0 answers