mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] perf script flamegraph: Fix input file name errors
@ 2026-10-01 18:19 Stephen Brennan
  2026-10-01 18:20 ` [PATCH 1/2] tools: perf: add perf_input_name() helper Stephen Brennan
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Stephen Brennan @ 2026-10-01 18:19 UTC (permalink / raw)
  To: Peter Zijlstra, Namhyung Kim, Arnaldo Carvalho de Melo, Ingo Molnar
  Cc: Stephen Brennan, linux-kernel, James Clark, Mark Rutland,
	Jiri Olsa, Ian Rogers, Alexander Shishkin, Adrian Hunter,
	linux-perf-users

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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-10-02 18:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-01 18:19 [PATCH 0/2] perf script flamegraph: Fix input file name errors Stephen Brennan
2026-10-01 18:20 ` [PATCH 1/2] tools: perf: add perf_input_name() helper Stephen Brennan
2026-10-01 18:20 ` [PATCH 2/2] tools: perf: flamegraph.py: fix "Error reading report header" Stephen Brennan
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®