夜阑卧听风吹雨 發表於 2024-3-30 00:09:00

ubuntu环境下安装perf工具

<p>检查当前环境内核的版本,执行如下命令:</p>
<pre><code class="language-shell">uname -a
</code></pre>
<p>输出信息如下:</p>
<pre><code class="language-shell">Linux jackie-ubuntu 5.4.0-26-generic #30-Ubuntu SMP Mon Apr 20 16:58:30 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
</code></pre>
<p>安装<code>perf</code>工具,执行如下命令:</p>
<pre><code class="language-shell">sudo apt-get update
sudo apt-get upgrade
sudo apt-get autoremove
sudo apt-get install linux-tools-common linux-tools-$(uname -r)
</code></pre>
<p>查看<code>perf</code>工具的版本,执行如下命令:</p>
<pre><code class="language-shell">perf --version
</code></pre>
<p>输出信息如下:</p>
<pre><code class="language-shell">perf version 5.4.30
</code></pre>
<p>查看<code>perf</code>命令的使用帮助,输出信息如下:</p>
<pre><code class="language-shell"> usage: perf [--version] [--help] COMMAND

The most commonly used perf commands are:
   annotate      Read perf.data (created by perf record) and display annotated code
   archive         Create archive with object files with build-ids found in perf.data file
   bench         General framework for benchmark suites
   buildid-cache   Manage build-id cache.
   buildid-list    List the buildids in a perf.data file
   c2c             Shared Data C2C/HITM Analyzer.
   config          Get and set variables in a configuration file.
   data            Data file related processing
   diff            Read perf.data files and display the differential profile
   evlist          List the event names in a perf.data file
   ftrace          simple wrapper for kernel's ftrace functionality
   inject          Filter to augment the events stream with additional information
   kallsyms      Searches running kernel for symbols
   kmem            Tool to trace/measure kernel memory properties
   kvm             Tool to trace/measure kvm guest os
   list            List all symbolic event types
   lock            Analyze lock events
   mem             Profile memory accesses
   record          Run a command and record its profile into perf.data
   report          Read perf.data (created by perf record) and display the profile
   sched         Tool to trace/measure scheduler properties (latencies)
   script          Read perf.data (created by perf record) and display trace output
   stat            Run a command and gather performance counter statistics
   test            Runs sanity tests.
   timechart       Tool to visualize total system behavior during a workload
   top             System profiling tool.
   version         display the version of perf binary
   probe         Define new dynamic tracepoints
   trace         strace inspired tool

See 'perf help COMMAND' for more information on a specific command.
</code></pre>
<h3 id="参考资料">参考资料</h3>
<ul>
<li>ubuntu中安装perf</li>
<li>学会使用perf性能分析工具(含移植到arm-linux开发板)</li>
<li>手把手教你系统级性能分析工具perf的介绍与使用(超详细)</li>
<li>【Ubuntu】 Perf工具的使用</li>
<li>perf性能分析工具使用分享</li>
<li>Perf -- Linux下的系统性能调优工具</li>
<li>Linux kernel profiling with perf</li>
<li>Perfcounters added to the mainline</li>
<li>Performance Counters on Linux The New Tools</li>
</ul>


</div>
<div id="MySignature" role="contentinfo">
    <p>本文来自博客园,作者:jackieathome,转载请注明原文链接:https://www.cnblogs.com/jackieathome/p/18104899</p><br><br>
来源:https://www.cnblogs.com/jackieathome/p/18104899
頁: [1]
查看完整版本: ubuntu环境下安装perf工具