perf record --call-graph dwarf -e cpu-clock -F 99 -a -g -p $(ps aux | grep DataService | grep -v grep | awk '{print $2}') -- sleep 120
perf script -i perf.data | FlameGraph/stackcollapse-perf.pl | FlameGraph/flamegraph.pl > process.svg
diff flame
perf record -F 99 -a -g -- sleep 30
perf script > out.stacks1
perf record -F 99 -a -g -- sleep 30
perf script > out.stacks2
cd FlameGraph
./stackcollapse-perf.pl ../out.stacks1 > out.folded1
./stackcollapse-perf.pl ../out.stacks2 > out.folded2
./difffolded.pl out.folded1 out.folded2 | ./flamegraph.pl > diff2.svg
perf-tools: https://github.com/brendangregg/perf-tools
FlameGraph: https://github.com/brendangregg/FlameGraph
perf example: http://www.brendangregg.com/perf.html#Symbols
-fno-omit-frame-pointer
重新编译--call-graph dwarf
视情况而定,使用错误可能会 No stack-fno-omit-frame-pointer
避免优化帧指针,能够更好的还原调用堆栈。-O2
级别以下的优化选项默认带
#11