summaryrefslogtreecommitdiff
path: root/tools/perf/python/ilist.py
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2025-12-02 09:49:57 -0800
committerNamhyung Kim <namhyung@kernel.org>2025-12-02 16:12:49 -0800
commit4b11c983f453689ac9d51d6528891ab4beb7393e (patch)
treebdbce7421e75314a62e89255ccdbd74ffcbfb6c2 /tools/perf/python/ilist.py
parent6603c3c1fe8257e522496da7fd7b75ac52c2323f (diff)
perf ilist: Be tolerant of reading a metric on the wrong CPU
This happens on hybrid machine metrics. Be tolerant and don't cause the ilist application to crash with an exception. Signed-off-by: Ian Rogers <irogers@google.com> Tested-by: Thomas Falcon <thomas.falcon@intel.com> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Diffstat (limited to 'tools/perf/python/ilist.py')
-rwxr-xr-xtools/perf/python/ilist.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/tools/perf/python/ilist.py b/tools/perf/python/ilist.py
index eb687ce9d5a6..0d757ddb4795 100755
--- a/tools/perf/python/ilist.py
+++ b/tools/perf/python/ilist.py
@@ -77,8 +77,12 @@ class Metric(TreeValue):
return perf.parse_metrics(self.metric_name, self.metric_pmu)
def value(self, evlist: perf.evlist, evsel: perf.evsel, cpu: int, thread: int) -> float:
- val = evlist.compute_metric(self.metric_name, cpu, thread)
- return 0 if math.isnan(val) else val
+ try:
+ val = evlist.compute_metric(self.metric_name, cpu, thread)
+ return 0 if math.isnan(val) else val
+ except:
+ # Be tolerant of failures to compute metrics on particular CPUs/threads.
+ return 0
@dataclass