1

我有一个程序,它使用perf_event.h来计算特定运行进程的IPC 。为此,我阅读了INSTRUCTIONS计数器和CPU_CYCLES计数器。

我的问题是关于INSTRUCTIONS计数器返回的值。它是否包含浮点运算?如果没有,我怎样才能得到这个值?

注意:我说的是perf_event.h,但是,是的,我也在说perf,我提到的计数器是您可以使用 command 找到的计数器perf list

4

1 回答 1

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)

于 2014-06-10T09:33:44.103 回答