自学内容网 自学内容网

Perf生成火焰图分析程序性能

1.一般linux系统自带perf,没有需要安装,没有需要安装

sudo apt install linux-tools-common linux-tools-generic

2.额外安装FlameGraph

git clone https://github.com/brendangregg/FlameGraph.git

3.运行

需要把运行库so拷贝到系统目录

sudo perf record -e cycles -F 99 -a -g -- ./**

(根据执行程序修改--后面内容)

sudo perf script -i perf.data &> perf-record.txt

sudo ../../../FlameGraph/stackcollapse-perf.pl ./perf-record.txt &> out.txt

sudo ../../../FlameGraph/flamegraph.pl ./out.txt > ./out.svg

out.svg即火焰图,用浏览器打开


原文地址:https://blog.csdn.net/huntenganwei/article/details/142827262

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!