How to measure the precise clock of a piece of code ?
Alger fog use this following method
_rdpmc
{
cpuid
rdpmc
cpuid
}
first test overhead of these instruction by finding the minum time interval between two _rdpmc .
But I find it varies greately . Iested 1000 times. Most cases , the minumum overhead is 420 cyles.
While sometimes it is 188 cycle. It varies greately . What cause the difference ?
I use taskset -C to test this to reduce shift beteen process.



