5

I was trying to figure out if there is any easy method to convert the CPU cycles obtained in C using rdtsc() function into time in seconds.

ex:-

unsigned long long start, stop; start = rdtsc(); stop = rdtsc(); printf(" CPU CYCLES: %llu\n", b-a); 

is there any possible way to convert this into time in seconds?

2
  • 1
    Also see this stackoverflow.com/questions/42189976/… Commented Dec 10, 2017 at 1:27
  • 2
    In particular, see the (currently) second answer in the question Dmitriy links above. Intel changed how the TSC behaves. In current processors, it is not a CPU-cycle counter. And “CPU cycles to seconds” is not meaningful in processors that change their frequency depending on temperature and other factors. This may be an XY problem. What do you really want to get—wall clock time, number of CPU cycles, or something else? Commented Dec 10, 2017 at 1:52

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.