[PATCH v3 58/58] fixup! perf check-perf-trace: Port check-perf-trace to use python module

Ian Rogers
2026-04-23T16:12:11Z

---
tools/perf/python/check-perf-trace.py | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/tools/perf/python/check-perf-trace.py b/tools/perf/python/check-perf-trace.py
index 4c05540bdc05..2e8a40306c78 100755
--- a/tools/perf/python/check-perf-trace.py
+++ b/tools/perf/python/check-perf-trace.py
@@ -49,9 +49,16 @@ def print_header(event_name: str, sample: perf.sample_event) -> None:
"""Prints common header for events."""
secs = sample.sample_time // 1000000000
nsecs = sample.sample_time % 1000000000
- comm = session.process(sample.sample_pid).comm() if session else "[unknown]"
+ comm = "[unknown]"
+ if session:
+ try:
+ proc = session.process(sample.sample_tid)
+ if proc:
+ comm = proc.comm()
+ except (TypeError, AttributeError):
+ pass
print(f"{event_name:<20} {sample.sample_cpu:5} {secs:05}.{nsecs:09} "
- f"{sample.sample_pid:8} {comm:<20} ", end=' ')
+ f"{sample.sample_tid:8} {comm:<20} ", end=' ')

def print_uncommon(sample: perf.sample_event) -> None:
"""Prints uncommon fields for tracepoints."""
--
2.54.0.rc2.533.g4f5dca5207-goog