有没有办法找出perf (Linux分析工具)中的预定义事件的原始编码?
例如,我们使用perf stat -e instructions userexecutable
来计数指令的数量。 perf可以显示事件“指令”的原始编码吗?
你可以看看位于/sys/devices/cpu/events/
没有我会意识到的。 请注意,事件是特定于处理器的。 例如,在Power8上,指令被一个结构( libpfm4源 )引用:
[ POWER8_PME_PM_INST_CMPL ] = { .pme_name = "PM_INST_CMPL", .pme_code = 0x2, .pme_short_desc = "Number of PowerPC Instructions that completed.", .pme_long_desc = "PPC Instructions Finished (completed).", },
指令计数可以使用收集
perf stat -e r2 userexecutable
对于你的处理器,会有类似的转换,但是我不知道更少的手动方式。