This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
tsg-tsg-performance-test-tools/FlameGraph/2_conversion_data.sh
luwenpeng 7a8342a048 增加脚本用于生产火焰图
1_collect_data.sh    : 采集指定 CPU 的运行数据
	2_conversion_data.sh :将采集的数据转化成火焰图
2021-07-14 10:45:09 +00:00

27 lines
649 B
Bash

#!/bin/bash
if [ ! -f "perf.data" ]; then
echo "Please Collect data !"
exit 0
fi
if [ ! -d FlameGraph ]; then
echo "git clone https://github.com/brendangregg/FlameGraph.git"
git clone https://github.com/brendangregg/FlameGraph.git
fi
rm -rf perf.unfold
rm -rf perf.folded
rm -rf perf.svg
# 用 perf script 工具对 perf.data 进行解析
perf script -i perf.data &> perf.unfold
# 将 perf.unfold 中的符号进行折叠
./FlameGraph/stackcollapse-perf.pl perf.unfold &> perf.folded
# 生成 svg 图
./FlameGraph/flamegraph.pl perf.folded > perf.svg
# 使用浏览器查看 perf.svg, 在浏览器中使用 Ctrl + F 进行关键字搜索