From: Jens Remus <jremus@linux.ibm.com>
To: Ian Rogers <irogers@google.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Namhyung Kim <namhyung@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>
Cc: Jens Remus <jremus@linux.ibm.com>,
Jan Polensky <japo@linux.ibm.com>,
Sumanth Korikkar <sumanthk@linux.ibm.com>,
Heiko Carstens <hca@linux.ibm.com>,
Vasily Gorbik <gor@linux.ibm.com>,
Alexander Gordeev <agordeev@linux.ibm.com>,
linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 0/5] perf python: Honor more perf script options
Date: Fri, 4 Dec 2026 17:24:27 +0100 [thread overview]
Message-ID: <20261204162426.4171717-7-jremus@linux.ibm.com> (raw)
While updating my own perf scripts for commit b02aa1d1343f ("perf
script: Support standalone scripts and remove embedded scripting") I
noticed that perf script accepts but ignores most of its options when
running a Python script:
$ perf script [<options>] -s ~/my_script.py
Only --vmlinux, --kallsyms, --symfs and --itrace are forwarded to the
script's perf.session, via environment variables. perf.session itself
hard-codes the other symbol settings, and two of them differ from the
perf script defaults: it does not resolve inlined frames, and it reports
the kernel DSO by its vmlinux path. So a script cannot reproduce the
output of plain perf script. Neither the command line nor the script
itself can change these settings, because perf.session has no arguments
for them. I use some of these options, so this series forwards
--inline, --show-kernel-path, --max-stack, --demangle and
--demangle-kernel.
For each option, perf.session gains a keyword argument, so a script can
set it itself. If it is not given, perf.session uses an environment
variable set by perf script from the option, and otherwise the previous
hard-coded value. Scripts run directly only gain the keyword arguments,
their defaults do not change.
Behavior change: Python scripts run by perf script now resolve inlined
frames and report the kernel DSO as "[kernel.kallsyms]", like perf script
does. Use --no-inline and --show-kernel-path to get the old behavior.
Patch 1 also adds callchain_node.inlined, so scripts can tell inlined
frames from the frame they are inlined into. Patch 2 exports this flag
in the SQLite and PostgreSQL export scripts, which adds a column to the
symbols table.
Note: On s390 test_export_to_sqlite_python.sh fails, independent of this
series, because "perf record -g" defaults to --call-graph dwarf there.
The resulting samples exceed sizeof(union perf_event), which commit
2c672ffdad4b ("perf python: Lazily copy events and samples from
process_events") rejects with "Unexpected event size: 4168 < 8536".
Based on v7.4-rc4.
Regards,
Jens
Jens Remus (5):
perf python: Support inlined frames in callchains
perf python: Export inlined symbol flag in DB export scripts
perf python: Honor perf script --show-kernel-path
perf python: Honor perf script --demangle and --demangle-kernel
perf python: Honor perf script --max-stack
.../perf/Documentation/perf-script-python.txt | 11 +-
tools/perf/builtin-script.c | 9 ++
tools/perf/python/export-to-postgresql.py | 32 ++---
tools/perf/python/export-to-sqlite.py | 18 +--
tools/perf/python/perf.pyi | 24 +++-
tools/perf/util/python.c | 119 +++++++++++++++++-
6 files changed, 180 insertions(+), 33 deletions(-)
base-commit: b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f
--
2.53.0
next reply other threads:[~2026-12-04 16:24 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 16:24 Jens Remus [this message]
2026-12-04 16:24 ` [PATCH 1/5] perf python: Support inlined frames in callchains Jens Remus
2026-12-04 16:46 ` sashiko-bot
2026-12-04 16:24 ` [PATCH 2/5] perf python: Export inlined symbol flag in DB export scripts Jens Remus
2026-12-04 16:59 ` sashiko-bot
2026-12-04 16:24 ` [PATCH 3/5] perf python: Honor perf script --show-kernel-path Jens Remus
2026-12-04 17:13 ` sashiko-bot
2026-12-04 16:24 ` [PATCH 4/5] perf python: Honor perf script --demangle and --demangle-kernel Jens Remus
2026-12-04 16:24 ` [PATCH 5/5] perf python: Honor perf script --max-stack Jens Remus
2026-12-04 17:35 ` sashiko-bot
2026-12-04 17:35 ` [PATCH 0/5] perf python: Honor more perf script options sashiko-bot
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=20261204162426.4171717-7-jremus@linux.ibm.com \
--to=jremus@linux.ibm.com \
--cc=acme@kernel.org \
--cc=agordeev@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=irogers@google.com \
--cc=japo@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=sumanthk@linux.ibm.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.