perf 进行程序性能统计

挖个坑,有空写一下利用perf 进行程序性能统计并绘制火焰图进行展示的方法。

 1. perf 安装

1 git clone --depth 1 https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
2 cd linux/tools/perf
3 make
4 cp perf /usr/bin

然后运行: perf --version 检查perf安装成功

2. 运行
参考: https://www.brendangregg.com/perf.html

perf record --call-graph dwarf ./perf-test
 
 
 
posted @ 2022-08-11 20:17  cofludy  阅读(23)  评论(0编辑  收藏  举报