RDTSC on Corei5
Posted: Thu Dec 29, 2011 9:31 am
2 quick questions regarding RDTSC
a) Does RDTSC return the number of CPU clock-ticks since boot?
b) If so -
On my Core i5 (520M), I have tried to use RDTSC to calculate the CPU speed.
I read the TSC, wait for 100ms, read again and take the difference.
For some reason, it is telling me the difference is ~2.1 billion ticks.
I know the timing loop is correct as I also use it to calculate the FSB (which is coming back as 1066Mhz).
I was about to multiply the TSC diff by 10 (to get seconds) when I noticed it was already huge . I have checked the start and end TSC readings, and manually calculated the difference = 2 billion.
Am I getting 10 ticks per clock cycle or is something else weird going on?
a) Does RDTSC return the number of CPU clock-ticks since boot?
b) If so -
On my Core i5 (520M), I have tried to use RDTSC to calculate the CPU speed.
I read the TSC, wait for 100ms, read again and take the difference.
For some reason, it is telling me the difference is ~2.1 billion ticks.
I know the timing loop is correct as I also use it to calculate the FSB (which is coming back as 1066Mhz).
I was about to multiply the TSC diff by 10 (to get seconds) when I noticed it was already huge . I have checked the start and end TSC readings, and manually calculated the difference = 2 billion.
Am I getting 10 ticks per clock cycle or is something else weird going on?