History log of /linux-master/tools/perf/scripts/python/bin/flamegraph-report
Revision Date Author Comments
# 19ce2321 05-May-2020 Arnaldo Carvalho de Melo <acme@redhat.com>

perf flamegraph: Use /bin/bash for report and record scripts

As all the other tools/perf/scripts/python/bin/*-{report,record}
scripts, fixing the this problem reported by Daniel Diaz:

Our OpenEmbedded builds detected an issue with 5287f9269206 ("perf
script: Add flamegraph.py script"):
ERROR: perf-1.0-r9 do_package_qa: QA Issue:
/usr/libexec/perf-core/scripts/python/bin/flamegraph-report contained
in package perf-python requires /usr/bin/sh, but no providers found in
RDEPENDS_perf-python? [file-rdeps]

This means that there is a new binary pulled in in the shebang line
which was unaccounted for: `/usr/bin/sh`. I don't see any other usage
of /usr/bin/sh in the kernel tree (does not even exist on my Ubuntu
dev machine) but plenty of /bin/sh. This patch is needed:
-----8<----------8<----------8<-----
diff --git a/tools/perf/scripts/python/bin/flamegraph-record
b/tools/perf/scripts/python/bin/flamegraph-record
index 725d66e71570..a2f3fa25ef81 100755
--- a/tools/perf/scripts/python/bin/flamegraph-record
+++ b/tools/perf/scripts/python/bin/flamegraph-record
@@ -1,2 +1,2 @@
-#!/usr/bin/sh
+#!/bin/sh
perf record -g "$@"
diff --git a/tools/perf/scripts/python/bin/flamegraph-report
b/tools/perf/scripts/python/bin/flamegraph-report
index b1a79afd903b..b0177355619b 100755
--- a/tools/perf/scripts/python/bin/flamegraph-report
+++ b/tools/perf/scripts/python/bin/flamegraph-report
@@ -1,3 +1,3 @@
-#!/usr/bin/sh
+#!/bin/sh
# description: create flame graphs
perf script -s "$PERF_EXEC_PATH"/scripts/python/flamegraph.py -- "$@"
----->8---------->8---------->8-----

Fixes: 5287f9269206 ("perf script: Add flamegraph.py script")
Reported-by: Daniel Díaz <daniel.diaz@linaro.org>
Acked-by: Andreas Gerstmayr <agerstmayr@redhat.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: lkft-triage@lists.linaro.org
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lore.kernel.org/lkml/CAEUSe7_wmKS361mKLTB1eYbzYXcKkXdU26BX5BojdKRz8MfPCw@mail.gmail.com
Link: http://lore.kernel.org/lkml/20200505170320.GZ30487@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>


# 5287f926 20-Mar-2020 Andreas Gerstmayr <agerstmayr@redhat.com>

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 <agerstmayr@redhat.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Brendan Gregg <bgregg@netflix.com>
Cc: Martin Spier <mspier@netflix.com>
Link: http://lore.kernel.org/lkml/20200320151355.66302-1-agerstmayr@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>