Skip to content

Commit 29b60bf

Browse files
committed
Improved flame graph script
1 parent aa4e3d5 commit 29b60bf

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

ydb/tests/tools/kqprun/flame_graph.sh

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
#!/usr/bin/env bash
22

3-
# For svg graph download https://github.com/brendangregg/FlameGraph
4-
# and run `FlameGraph/stackcollapse-perf.pl profdata.txt | FlameGraph/flamegraph.pl > profdata.svg`
3+
set -eux
54

6-
pid=$(pgrep -u $USER kqprun)
5+
kqprun_pid=$(pgrep -u $USER kqprun)
76

8-
echo "Target process id: ${pid}"
9-
10-
sudo perf record -F 50 --call-graph dwarf -g --proc-map-timeout=10000 --pid $pid -v -o profdata -- sleep 30
7+
sudo perf record -F 50 --call-graph dwarf -g --proc-map-timeout=10000 --pid $kqprun_pid -v -o profdata -- sleep ${1:-'30'}
118
sudo perf script -i profdata > profdata.txt
9+
10+
flame_graph_tool="../../../../contrib/tools/flame-graph/"
11+
12+
${flame_graph_tool}/stackcollapse-perf.pl profdata.txt | ${flame_graph_tool}/flamegraph.pl > profdata.svg

0 commit comments

Comments
 (0)