mirror of
https://github.com/torvalds/linux.git
synced 2026-06-04 04:23:35 +02:00
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@google.com> Tested-by: Thomas Falcon <thomas.falcon@intel.com> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
This commit is contained in:
parent
a1d9bb1a04
commit
d9f2ce394c
|
|
@ -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."""
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user