ubuntu下安装c++检测工具perf

来源:互联网 发布:抓包软件 编辑:程序博客网 时间:2024/05/16 06:50
ubuntu下安装c++检测工具perf

sudo apt-get install linux-tools-common


sudo apt-get install linux-tools-4.4.0-62-generic

sudo apt-get install linux-cloud-tools-4.4.0-62-generic


使用:

将它编译为可执行文件 test1

  gcc – o test1 – g test.c

  注意:此处一定要加-g选项,加入调试和符号表信息。

执行:perf stat ./test1 


Perf top

Perf top 用于实时显示当前系统的性能统计信息。该命令主要用来观察整个系统当前的状态,比如可以通过查看该命令的输出来查看当前系统最耗时的内核函数或某个用户进程。


4.1查找时间上的热点函数

  perf record – e cpu-clock ./test1

  perf report


0 0
原创粉丝点击