Linux命令系列:perf

1
2
3
4
5
6
7
8
9
10
11
12
13
perf record -e cpu-clock -g -p pid
#-g 选项是告诉perf record额外记录函数的调用关系
#-e cpu-clock 指perf record监控的指标为cpu周期
#-p 指定需要record的进程pid
perf report -i perf.data


perf record -e cpu-clock -g -p pid
perf script -i perf.data &> perf.unfold
git clone https://github.com/brendangregg/FlameGraph --depth=1
cd FlameGraph
./stackcollapse-perf.pl ../perf.unfold &> ../perf.folded
./flamegraph.pl ../perf.folded > ../perf.svg