Skip to content

Commit

Permalink
add stacks_to_flames.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
proger committed Sep 11, 2013
1 parent cd88100 commit 44c5be4
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions stacks_to_flames.sh
@@ -0,0 +1,18 @@
#!/bin/zsh

# This scripts renders separate flame graphs for each process in the file at the first argument
# Canvas sizes are tuned relatively to the longest running process (max is $maxwidth)

# usage:
# deps/eflame/stacks_to_flames.sh stacks.out

me="$(dirname $0)"
f=${1:-stacks.out}
maxwidth=${maxwidth:-1430}

for width pid in $(awk -F';' '{print $1}' $f | uniq -c | tr -d '<>' | sort -rn -k1); do
max=${max:-$width.0}
echo -n "pid: $pid\tsamples: $width\t"
grep $pid $f | $me/flamegraph.pl --title="$title ($pid)" --width=$(($maxwidth / $max * $width)) > flame_$pid.svg
echo flame_$pid.svg
done

0 comments on commit 44c5be4

Please sign in to comment.