perf python: Correct pyrf_evsel__read for tool PMUs
authorIan Rogers <irogers@google.com>
Thu, 10 Jul 2025 23:51:24 +0000 (16:51 -0700)
committerNamhyung Kim <namhyung@kernel.org>
Fri, 11 Jul 2025 19:36:40 +0000 (12:36 -0700)
commit6183afcba9c1c810656ddb36170106aaf3cf778c
tree46956e7999b29cd82c16edc9acf7b3f8d3b40076
parent64ec9b997f3a9462901a404ad60f452f76dd2d6e
perf python: Correct pyrf_evsel__read for tool PMUs

Tool PMUs assume that stat's process_counter_values is being used to
read the counters. Specifically they hold onto old values in
evsel->prev_raw_counts and give the cumulative count based off of this
value. Update pyrf_evsel__read to allocate counts and prev_raw_counts,
use evsel__read_counter rather than perf_evsel__read so tool PMUs are
read from not just perf_event_open events, make the returned
pyrf_counts_values contain the delta value rather than the cumulative
value.

Fixes: 739621f65702 ("perf python: Add evsel read method")
Signed-off-by: Ian Rogers <irogers@google.com>
Link: https://lore.kernel.org/r/20250710235126.1086011-12-irogers@google.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
tools/perf/util/python.c