aboutsummaryrefslogtreecommitdiff
path: root/tools/perf/scripts/python/bin/flamegraph-record
diff options
context:
space:
mode:
authorAndreas Gerstmayr <[email protected]>2020-03-20 16:13:48 +0100
committerArnaldo Carvalho de Melo <[email protected]>2020-04-16 12:19:14 -0300
commit5287f926920688e1151741d49da37a533ccf1960 (patch)
tree44d6c14e751e540ea036553c7c4a6b53e8072ede /tools/perf/scripts/python/bin/flamegraph-record
parent47352aba40035ab3fdc50dd03a94456feabed7d8 (diff)
perf script: Add flamegraph.py script
This script works in tandem with d3-flame-graph to generate flame graphs from perf. It supports two output formats: JSON and HTML (the default). The HTML format will look for a standalone d3-flame-graph template file in /usr/share/d3-flame-graph/d3-flamegraph-base.html and fill in the collected stacks. Usage: perf record -a -g -F 99 sleep 60 perf script report flamegraph Combined: perf script flamegraph -a -F 99 sleep 60 Committer testing: Tested both with "PYTHON=python3" and with the default, that uses python2-devel: Complete set of instructions: $ mkdir /tmp/build/perf $ make PYTHON=python3 -C tools/perf O=/tmp/build/perf install-bin $ export PATH=~/bin:$PATH $ perf record -a -g -F 99 sleep 60 $ perf script report flamegraph Now go and open the generated flamegraph.html file in a browser. At first this required building with PYTHON=python3, but after I reported this Andreas was kind enough to send a patch making it work with both python and python3. Signed-off-by: Andreas Gerstmayr <[email protected]> Tested-by: Arnaldo Carvalho de Melo <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Brendan Gregg <[email protected]> Cc: Martin Spier <[email protected]> Link: http://lore.kernel.org/lkml/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
Diffstat (limited to 'tools/perf/scripts/python/bin/flamegraph-record')
-rwxr-xr-xtools/perf/scripts/python/bin/flamegraph-record2
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/perf/scripts/python/bin/flamegraph-record b/tools/perf/scripts/python/bin/flamegraph-record
new file mode 100755
index 000000000000..725d66e71570
--- /dev/null
+++ b/tools/perf/scripts/python/bin/flamegraph-record
@@ -0,0 +1,2 @@
+#!/usr/bin/sh
+perf record -g "$@"