From 43f7f683d0ac667f2a5273f5e9a3ec0fc0d999e1 Mon Sep 17 00:00:00 2001 From: Vaxry Date: Sat, 4 Apr 2026 13:24:42 +0100 Subject: debug-tools: add flame --- debug-tools/flamegraph.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 debug-tools/flamegraph.sh (limited to 'debug-tools') diff --git a/debug-tools/flamegraph.sh b/debug-tools/flamegraph.sh new file mode 100755 index 00000000..73d54b4b --- /dev/null +++ b/debug-tools/flamegraph.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +FLAMEGRAPH_DIR="$SCRIPT_DIR/flamegraph" + +if [ ! -d "$FLAMEGRAPH_DIR" ]; then + echo "Cloning FlameGraph tools..." + git clone https://github.com/brendangregg/FlameGraph "$FLAMEGRAPH_DIR" +fi + +if [ ! -f perf.data ]; then + echo "No perf.data found in current directory." + echo "Run Hyprland under perf first:" + echo " perf record -F 99 -g -- ./build/Hyprland" + exit 1 +fi + +echo "Generating flame graph..." +perf script | "$FLAMEGRAPH_DIR/stackcollapse-perf.pl" | "$FLAMEGRAPH_DIR/flamegraph.pl" > flame.svg +xdg-open flame.svg -- cgit v1.2.3