[PATCH v3 07/18] perf python: Expose sample instruction length
James Clark
james.clark at linaro.org
Mon Nov 2 04:15:21 PST 2026
Expose perf_sample::insn_len as a read-only insn_len attribute.
Trace decoders supply instruction lengths on synthesized samples to
indicate whether an instruction was executed or not during a call or
exception. Let scripts read this value directly.
Signed-off-by: James Clark <james.clark at linaro.org>
---
tools/perf/python/perf.pyi | 1 +
tools/perf/util/python.c | 1 +
2 files changed, 2 insertions(+)
diff --git a/tools/perf/python/perf.pyi b/tools/perf/python/perf.pyi
index 087da00728fd..525d34ed08dc 100644
--- a/tools/perf/python/perf.pyi
+++ b/tools/perf/python/perf.pyi
@@ -215,6 +215,7 @@ class sample_event(_sample_members):
sample_data_src: int
sample_insn_count: int
sample_cyc_count: int
+ insn_len: int
type: int
raw_buf: bytes
dso: Optional[str]
diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c
index 60dbe2dad5eb..d2aff058eb89 100644
--- a/tools/perf/util/python.c
+++ b/tools/perf/util/python.c
@@ -1380,6 +1380,7 @@ static PyGetSetDef pyrf_sample_event__getset[] = {
sample_member_def(sample_data_src, data_src, T_ULONGLONG, "event data source"),
sample_member_def(sample_insn_count, insn_cnt, T_ULONGLONG, "event instruction count"),
sample_member_def(sample_cyc_count, cyc_cnt, T_ULONGLONG, "event cycle count"),
+ sample_member_def(insn_len, insn_len, T_USHORT, "event instruction length"),
sample_member_def(flags, flags, T_UINT, "event flags"),
member_def(perf_event_header, type, T_UINT, "event type"),
{
--
2.43.0
More information about the linux-arm-kernel
mailing list