]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
perf jevents: Allow metric groups not to be named
authorIan Rogers <irogers@google.com>
Tue, 2 Dec 2025 17:50:01 +0000 (09:50 -0800)
committerNamhyung Kim <namhyung@kernel.org>
Wed, 3 Dec 2025 00:12:49 +0000 (16:12 -0800)
It can be convenient to have unnamed metric groups for the sake of
organizing other metrics and metric groups. An unspecified name
shouldn't contribute to the MetricGroup json value, so don't record
it.

Signed-off-by: Ian Rogers <irogers@google.com>
Tested-by: Thomas Falcon <thomas.falcon@intel.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
tools/perf/pmu-events/metric.py

index 1de4fb72c75ed51a467244ea846f33812899018b..847b614d40d5f3ac7e22c1c7384b001b8ba233cd 100644 (file)
@@ -455,7 +455,8 @@ class Metric:
 
   def AddToMetricGroup(self, group):
     """Callback used when being added to a MetricGroup."""
-    self.groups.add(group.name)
+    if group.name:
+      self.groups.add(group.name)
 
   def Flatten(self) -> Set['Metric']:
     """Return a leaf metric."""