use
# 安装perf
yum install perf -y
# 下载绘图工具
git clone https://github.com/brendangregg/FlameGraph.git
# 采集数据
perf record -F99-p3887-g -- sleep 30
# 生成火焰图
perf script -i perf.data &> perf.unfold
./FlameGraph/stackcollapse-perf.pl perf.unfold &> perf.folded
./FlameGraph/flamegraph.pl perf.folded > perf.svg
Meaning flame figure
- Flame figure is based on the stack information generated SVG images used to display the call stack CPU. The y-axis represents the call stack, each layer is a function.
- The deeper the call stack, the higher the flame, the function being executed is a top, the lower is its parent function. The x-axis represents the sample number, if a function of the width of the x-axis occupied by the wider,
- It means more times it is drawn, i.e., longer execution. Note that, x-axis does not mean time, but after all the combined call stack, arranged in alphabetical order.
- The figure is a function of the flame which occupies the top floor to see the maximum width. As long as there is "flat top" (plateaus), it indicates that the function may be a performance problem. Color has no special meaning,
- Because the flame figure shows the CPU is busy, it is generally choose warm colors.