Skip to content

Commit

Permalink
Improved flame graph script
Browse files Browse the repository at this point in the history
  • Loading branch information
GrigoriyPA committed Jan 6, 2025
1 parent aa4e3d5 commit 29b60bf
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions ydb/tests/tools/kqprun/flame_graph.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#!/usr/bin/env bash

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

pid=$(pgrep -u $USER kqprun)
kqprun_pid=$(pgrep -u $USER kqprun)

echo "Target process id: ${pid}"

sudo perf record -F 50 --call-graph dwarf -g --proc-map-timeout=10000 --pid $pid -v -o profdata -- sleep 30
sudo perf record -F 50 --call-graph dwarf -g --proc-map-timeout=10000 --pid $kqprun_pid -v -o profdata -- sleep ${1:-'30'}
sudo perf script -i profdata > profdata.txt

flame_graph_tool="../../../../contrib/tools/flame-graph/"

${flame_graph_tool}/stackcollapse-perf.pl profdata.txt | ${flame_graph_tool}/flamegraph.pl > profdata.svg

0 comments on commit 29b60bf

Please sign in to comment.