From: Stephen Brennan <stephen.s.brennan@oracle.com>
To: Peter Zijlstra <peterz@infradead.org>,
Namhyung Kim <namhyung@kernel.org>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Ingo Molnar <mingo@redhat.com>
Cc: Stephen Brennan <stephen.s.brennan@oracle.com>,
linux-kernel@vger.kernel.org,
James Clark <james.clark@linaro.org>,
Mark Rutland <mark.rutland@arm.com>, Jiri Olsa <jolsa@kernel.org>,
Ian Rogers <irogers@google.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Adrian Hunter <adrian.hunter@intel.com>,
linux-perf-users@vger.kernel.org
Subject: [PATCH 0/2] perf script flamegraph: Fix input file name errors
Date: Thu, 1 Oct 2026 11:19:59 -0700 [thread overview]
Message-ID: <20261001182004.1160406-1-stephen.s.brennan@oracle.com> (raw)
The flamegraph.py script has a "-i" option which it uses in an attempt to
know the input file name for the data it is processing. But perf itself is
using that flag and not forwarding its value to the script, so the entire
strategy won't work. It's further complicated by how the option processing
is handled in the flamegraph-report script -- details in patch 2.
This series introduces a helper to allow python scripts to see the input
file name, and then fixes flamegraph.py. Testing with a variety of options
like below shows that it is using the correct input files in most use cases
I can think of:
$ export PERF_EXEC_PATH=$(pwd)/tools/perf
$ sudo -E tools/perf/perf script flamegraph -a -F999 -- sleep 1
dumping data to flamegraph.html
$ sudo -E tools/perf/perf script record flamegraph \
-o myfile.data -a -F999 -- sleep 1
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 2.891 MB myfile.data (1832 samples) ]
$ sudo -E tools/perf/perf script report flamegraph -i myfile.data \
-- -o myfile.html
dumping data to myfile.html
$ sudo -E tools/perf/perf script \
-s tools/perf/scripts/python/flamegraph.py -i myfile.data
dumping data to flamegraph.html
$ sudo -E tools/perf/perf script record flamegraph \
-o - -a -F999 -- sleep 1 \
| tools/perf/perf script report flamegraph -i - -- -o manual.html
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 2.936 MB - ]
dumping data to manual.html
Stephen Brennan (2):
tools: perf: add perf_input_name() helper
tools: perf: flamegraph.py: fix "Error reading report header"
.../perf/Documentation/perf-script-python.txt | 1 +
.../scripts/python/Perf-Trace-Util/Context.c | 16 ++++++++++++++
tools/perf/scripts/python/flamegraph.py | 22 +++++++++----------
3 files changed, 27 insertions(+), 12 deletions(-)
--
2.52.0
next reply other threads:[~2026-10-01 18:21 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-01 18:19 Stephen Brennan [this message]
2026-10-01 18:20 ` [PATCH 1/2] tools: perf: add perf_input_name() helper Stephen Brennan
2026-10-02 9:12 ` sashiko-bot
2026-10-01 18:20 ` [PATCH 2/2] tools: perf: flamegraph.py: fix "Error reading report header" Stephen Brennan
2026-10-02 9:12 ` sashiko-bot
2026-10-02 5:24 ` [PATCH 0/2] perf script flamegraph: Fix input file name errors Ian Rogers
2026-10-02 18:27 ` Stephen Brennan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261001182004.1160406-1-stephen.s.brennan@oracle.com \
--to=stephen.s.brennan@oracle.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=irogers@google.com \
--cc=james.clark@linaro.org \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox