Skip to content

Instantly share code, notes, and snippets.

@tgrabiec
Last active September 6, 2018 11:21
Show Gist options
  • Save tgrabiec/1ffe65ef8fb0bec12a5efb07ec825096 to your computer and use it in GitHub Desktop.
Save tgrabiec/1ffe65ef8fb0bec12a5efb07ec825096 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# Usage: make-flame-graph.sh <perf-data-file-path>
#
# Produces perf-data-file-path.svg with the corresponding flame graph.
#
set -e
fg_dir=~/FlameGraph
if [ ! -e $fg_dir ]; then
sudo yum install -yq git 1>&2
git clone https://github.com/brendangregg/FlameGraph.git $fg_dir 1>&2
fi
export PATH=$PATH:$fg_dir
f=$1.svg
opts="-i $1"
perf script $opts | stackcollapse-perf.pl | flamegraph.pl > $f
echo $f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment