Linux kernel 了解性能统计输出中的数字

Linux kernel 了解性能统计输出中的数字,linux-kernel,profiling,perf,Linux Kernel,Profiling,Perf,我一直在尝试使用perf来分析我正在运行的进程,但我无法理解perf输出的一些数字,下面是我使用的命令和得到的输出: $ sudo perf stat -x, -v -e branch-misses,cpu-cycles,cache-misses sleep 1 Using CPUID GenuineIntel-6-55-4 branch-misses: 7751 444665 444665 cpu-cycles: 1212296 444665 444665 cache-misses: 490

我一直在尝试使用perf来分析我正在运行的进程,但我无法理解perf输出的一些数字,下面是我使用的命令和得到的输出:

$ sudo perf stat -x, -v -e branch-misses,cpu-cycles,cache-misses  sleep 1
Using CPUID GenuineIntel-6-55-4
branch-misses: 7751 444665 444665
cpu-cycles: 1212296 444665 444665
cache-misses: 4902 444665 444665
7751,,branch-misses,444665,100.00,,
1212296,,cpu-cycles,444665,100.00,,
4902,,cache-misses,444665,100.00,,
我可以知道数字444665代表什么事件吗?

-CSV格式部分介绍了性能统计的x格式。此手册页有一个片段,没有可选列:

CSV FORMAT         top

       With -x, perf stat is able to output a not-quite-CSV format output
       Commas in the output are not put into "". To make it easy to parse it
       is recommended to use a different character like -x \;

       The fields are in this order:
       ·   counter value
       ·   unit of the counter value or empty
       ·   event name
       ·   run time of counter
       ·   percentage of measurement time the counter was running

       Additional metrics may be printed with all earlier fields being
       empty.
所以,您有计数器的值、计数器的空单位、事件名称、运行时间、与程序运行时间相比处于活动状态的计数器的百分比

通过比较中建议的这两个命令的输出

-性能统计的x格式在第节CSV格式中描述。此手册页有一个片段,没有可选列:

CSV FORMAT         top

       With -x, perf stat is able to output a not-quite-CSV format output
       Commas in the output are not put into "". To make it easy to parse it
       is recommended to use a different character like -x \;

       The fields are in this order:
       ·   counter value
       ·   unit of the counter value or empty
       ·   event name
       ·   run time of counter
       ·   percentage of measurement time the counter was running

       Additional metrics may be printed with all earlier fields being
       empty.
所以,您有计数器的值、计数器的空单位、事件名称、运行时间、与程序运行时间相比处于活动状态的计数器的百分比

通过比较中建议的这两个命令的输出

不要使用-x,使用列标题的默认输出格式!更清楚的是,哪些列表示整个时间间隔内事件的计数。或者至少与不带-x的输出进行比较,看看匹配的是什么。睡眠并不是一个很好的选择,它几乎不花任何时间跑步,所以结果更吵。选择一个类似awk的开始{fori=0;我不使用-x,请使用带有列标题的默认输出格式!可以更清楚地看到哪些列表示整个时间间隔内事件的计数。或者至少与不使用-x输出的列进行比较,以查看匹配的内容。睡眠不是一个很好的配置文件选择,它几乎不会花费任何时间运行,因此结果不稳定呃,选择像awk'BEGIN{fori=0;i
perf stat -a   sleep 1
perf stat -Aa   sleep 1
perf stat -a -x ,  sleep 1
perf stat -Aa -x ,  sleep 1