Is FLOPS included in the number of instructions given by perf_event?

606 Views Asked by At

I have a program which uses perf_event.h to calculate the IPC of a specific running process. I read the INSTRUCTIONS counter and the CPU_CYCLES counter to do so.

My question is about the value returned by the INSTRUCTIONS counter. Does it contain the floating-point operations? If not, how can I get this value?

Note: I'm talking about perf_event.h but, yes, I'm also talking about perf and the counters I mentioned are the ones you can find with the command perf list.

1

There are 1 best solutions below

2
On BEST ANSWER

On Intel architectures (I guess it's the same for others), yes it contains floating-point instructions . If you look at arch/x86/kernel/cpu/perf_event_intel.c in kernel code. You will see that the instructions event is mapped to 0x00c0:

 [PERF_COUNT_HW_INSTRUCTIONS]     = 0x00c0

The Intel Software Developer Manual Chapter 19.1 says that this event counts Instruction retired, that is all instructions completed that were "proven" as indeed needed by flow (Modern processors execute much more instructions that the program flow needs. This is called "speculative execution", see here)