Open jcelerier opened 6 years ago
I speculate that it has to do with getMHZ_x86(void) in util.c.
It looks for "cpu MHz"; to get the CPU frequency and assumes rdtsc will tick with this frequency. On newer systems (the benchmark is quite old) the value is dynamically adjusted due to modern power management (DVFS etc.). So it will read random values (in interval 1500-3200 depending on the current frequency which your CPU is clocked to at that moment) for both of your benchmark invocations. However, rdtsc these days normally ticks at max CPU frequency.
If you just want to run the benchmark, a quick way to fix this is to set cpufreq to 'performance' using
echo performance | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
A long term fix is to use cpuid to get the frequency of rdtsc, or use the clock_gettime calls in Linux for taking the measurements. Feel free to submit a patch to fix it.
Btw. I'm not the author of the code (but I've used it in the past without issues).
Hello, I wanted to run your benchmark, but here are my figures :
as you can see, time2 - time1 is negative - I did multiple runs and provided you the highest case I had for time2 and the lowest case I had for time1.
If it can be useful :