I have to use rdtsc on ubuntu for performance evaluation. But i am not getting the correct value. I am placing a sleep on 10 seconds, but value i get is some 1 sec... i dont know where im going wrong?
cat /proc/cpuinfo gives
Last edited by vino; 09-18-2008 at 03:45 AM..
Reason: added code tags
This works on my computer just fine, after adjusting the constant to the value I find in my own proc/cpuinfo. Place printf statements after each getticks() call. Be sure to use %Ld:
printf("%Ld\n",tick1);
The problem is, that the CPU might throttle (with it does most of the time, when all processes are blocked), so a cpu clock might mean more time in that case. This is of course CPU and OS dependant.
I am trying to find out the Speed of the CPU while it is in 87.5 % Throttling. I am using RDTSC to get the Frequency of the Processor. Its reporting as 15 GHz while it is running in the lowest Speed. I need to validate whether CPU is running in the specified speed while it is in Throttling. As Calv notified i cannot use RDTSC, what could be the better way of doing. could you please any one help me.
I need to re-phrase your question --- please tell me if this is correct: How does one find out (on Linux) whether the CPU is actually running at the speed specified in cpuinfo?
Instead of the sleep statement above, set an alarm for 10 seconds, do some CPU-intensive work, get the number of ticks, compare the clocks to find how long the CPU actually slept (setting an alarm does not guarantee anything) and calculate. Use gettimeofday() to get the actual time.
Thanks for your idea. But i am using the application in a EFI environment. To get the Ticks processed we can use RDTSC only. Anyway i will try your logic.