I wonder how to measure instructions per cycle correctly using perf. As reference: http://www2.engr.arizona.edu/~tosiron/papers/SPEC2017_ISPASS18.pdf used inst_retired.any
and cpu_clk_unhalted.ref_tsc
for their calculations, and I'm now wondering if this is the correct approach. In comparison, PAPI uses the hardware counters PAPI_TOT_INS
and PAPI_TOT_CYC
to calculate the IPC.
After some measurements I concluded:
inst_retired.any:u
seems to be the same asPAPI_TOT_INS
cpu-cycles
seems to be the same asPAPI_TOT_CYC
On an example benchmark, cpu-cycles
differs from cpu_clk_unhalted.ref_tsc
by about 25%. The question is now, which of both values is the correct one for calculations? Or are both approaches wrong?