I followed instructions at http://blog.regehr.org/archives/794 and am able to count CPU cycles. My question is how can I convert these numbers into a "time" value? I naively assumed that if I knew the CPU clock speed, then dividing the number of (counted) CPU cycles by the clock speed would give me time in seconds. I am now not sure this is true. Any pointers?
Also, while we are here - is there a way to get the clock speed at runtime (via a library call?) or must I read from /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq?