简体   繁体   English

了解Perf工具输出

[英]Understanding Perf Tool Output

I recently installed Perf tool On my platform and wanted to use it for profiling my platform. 我最近在我的平台上安装了Perf工具,并希望用它来分析我的平台。 I started profiling a standalone application.Below command I used 我开始分析一个独立的应用程序。我用过的命令

perf start ./helloworld perf start ./helloworld

Performance counter stats for './helloworld': './helloworld'的效果统计信息:

  4.555957 task-clock                #    0.000 CPUs utilized
         1 context-switches          #    0.219 K/sec
         0 cpu-migrations            #    0.000 K/sec
       124 page-faults               #    0.027 M/sec
       <not supported> cycles
       <not supported> stalled-cycles-frontend
       <not supported> stalled-cycles-backend
       <not supported> instructions
       <not supported> branches
       <not supported> branch-misses

       60.005519331 seconds time elapsed

Now I am not sure how should I interpretate this output.is it expected output? 现在我不确定我应该如何解释这个输出。它是否预期输出?

Also,what should I make of < not supported > filed here,Is there anything I need to enable to support this filed before run the command? 此外,我应该在此处提交<不支持>的内容,在运行命令之前,是否需要启用任何支持此字段的内容?

The lines indicate that your running kernel is missing support for the particular functionality perf needs to profile those aspects of your program. 这些行表明您正在运行的内核缺少对perf需要分析程序的这些方面的特定功能的支持。 Since most of perf is in kernelspace, you need to ensure your kernel supports the features you need. 由于大多数perf都在内核空间中,因此您需要确保内核支持您需要的功能。

EDIT: 编辑:

When it comes to enabling those features in your kernel, it depends. 在内核中启用这些功能时,它取决于。 Unless those components have been compiled as kernel modules, you need to compile them yourself. 除非这些组件已编译为内核模块,否则您需要自己编译它们。 If they are compiled as modules, you can just modprobe them. 如果将它们编译为模块,则可以对它们进行modprobe Try: 尝试:

find /lib/modules/`uname -r` -regex .*perf.*

If a list appears, try modprobe ing each of the module names. 如果出现列表,请尝试modprobe每个模块名称。 Otherwise, you need to compile the modules yourself or the entire kernel yourself. 否则,您需要自己编译模块或自己编译整个内核。

Search for "Performance Events" in dmesg output. 在dmesg输出中搜索“性能事件”。 It might be disabled. 它可能被禁用。

For instance, on my machine, I have this>> 例如,在我的机器上,我有这个>>

Performance Events: SandyBridge events, Intel PMU driver.
PEBS disabled due to CPU errata.
CPUID marked event: 'cpu cycles' unavailable
CPUID marked event: 'instructions' unavailable
CPUID marked event: 'bus cycles' unavailable
CPUID marked event: 'cache references' unavailable
CPUID marked event: 'cache misses' unavailable
CPUID marked event: 'branch instructions' unavailable
CPUID marked event: 'branch misses' unavailable

"not supported" is usually when kernel does not support perf even if the kernel has perf modules enabled. “不支持”通常是内核不支持perf,即使内核已启用perf模块也是如此。 Or the hardware has not performance counters like some virtualized hardware may be? 或者硬件没有像某些虚拟化硬件那样的性能计数器? If there is no kernel support for perf, you will probably see "not counted" 如果没有针对perf的内核支持,您可能会看到“未计算”

It depends what you want to profile. 这取决于你想要描述的内容。 Perf doesn't provide an ultimate answer telling you how fast your program is. Perf没有提供最终答案,告诉你程序有多快。 If you want to measure performance you have to know where to look. 如果你想衡量表现,你必须知道在哪里看。 For those lines saying , try giving them manually by -e flag. 对于那些说法,请尝试用-e标志手动给它们。 like perf stat -e cycles ./helloworld 比如perf stat -e cycles ./helloworld

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM