In a benchmarking harness, I'm using a IA32_APERF/IA32_MPERF ratio to decide if the CPU clocked down during benchmarking. I sample the registers twice, once before the benchmark, and once after, then take a delta and compute a ratio. The registers are read in the same order both times.
Since turbo mode is disabled on the machine, in theory it shouldn't be possible to get a ratio of > 1. That's true for most cases, but one benchmark is the "empty benchmark". It does nothing, so it's runtime is close to 0 seconds. We are talking in the order of 10^{-6} seconds.
In this case, sometimes the ratio goes over 1. In an extreme case to >3. E.g. aperf_delta = 62049, mperf_delta = 17948, giving a ratio of around 3.46.
I know that to get an accurate ratio, the sample rate needs to be much (much) longer, but even so, the above result suggests that the IA32_APERF counter incremented faster than the IA32_MPERF. Since turbo mode is off, I don't think that should happen.
Should this be possible? Is there something I don't know about the accuracy of these two registers? As I say, it only seems to happen in this degenerate "empty benchmark" case.
Thanks