[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251113032040.1994090-13-irogers@google.com>
Date: Wed, 12 Nov 2025 19:20:00 -0800
From: Ian Rogers <irogers@...gle.com>
To: Adrian Hunter <adrian.hunter@...el.com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>, Benjamin Gray <bgray@...ux.ibm.com>,
Caleb Biggers <caleb.biggers@...el.com>, Edward Baker <edward.baker@...el.com>,
Ian Rogers <irogers@...gle.com>, Ingo Molnar <mingo@...hat.com>,
James Clark <james.clark@...aro.org>, Jing Zhang <renyu.zj@...ux.alibaba.com>,
Jiri Olsa <jolsa@...nel.org>, John Garry <john.g.garry@...cle.com>, Leo Yan <leo.yan@....com>,
Namhyung Kim <namhyung@...nel.org>, Perry Taylor <perry.taylor@...el.com>,
Peter Zijlstra <peterz@...radead.org>, Samantha Alt <samantha.alt@...el.com>,
Sandipan Das <sandipan.das@....com>, Thomas Falcon <thomas.falcon@...el.com>,
Weilin Wang <weilin.wang@...el.com>, Xu Yang <xu.yang_2@....com>, linux-kernel@...r.kernel.org,
linux-perf-users@...r.kernel.org
Subject: [PATCH v8 12/52] perf jevents: Skip optional metrics in metric group list
For metric groups, skip metrics in the list that are None. This allows
functions to better optionally return metrics.
Signed-off-by: Ian Rogers <irogers@...gle.com>
---
tools/perf/pmu-events/metric.py | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/tools/perf/pmu-events/metric.py b/tools/perf/pmu-events/metric.py
index b39189182608..dd8fd06940e6 100644
--- a/tools/perf/pmu-events/metric.py
+++ b/tools/perf/pmu-events/metric.py
@@ -493,13 +493,15 @@ class MetricGroup:
"""
def __init__(self, name: str,
- metric_list: List[Union[Metric, 'MetricGroup']],
+ metric_list: List[Union[Optional[Metric], Optional['MetricGroup']]],
description: Optional[str] = None):
self.name = name
- self.metric_list = metric_list
+ self.metric_list = []
self.description = description
for metric in metric_list:
- metric.AddToMetricGroup(self)
+ if metric:
+ self.metric_list.append(metric)
+ metric.AddToMetricGroup(self)
def AddToMetricGroup(self, group):
"""Callback used when a MetricGroup is added into another."""
--
2.51.2.1041.gc1ab5b90ca-goog
Powered by blists - more mailing lists