1

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.

David Guyon
  • 2,759
  • 1
  • 28
  • 40

1 Answers1

1

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)

Manuel Selva
  • 18,554
  • 22
  • 89
  • 134
  • I didn't know the *Intel Software Developer Manual*. Now, this is my bible for a better understanding of my Intel CPU and its interpretation by my Linux OS. Thanks. – David Guyon Jun 11 '14 at 08:46
  • Yes this document is a must have for anyone wanting to understand its Linux OS running on top of Intel processor. Nevertheless it's quite difficult to read and very dense. – Manuel Selva Jun 11 '14 at 09:09