summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2026-01-27 21:44:46 +0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2026-01-28 21:18:45 +0300
commit17d616b7d98dcc15561b83a7e1c78f304b8cea74 (patch)
tree6f2d93c18685b21917e0af4b6b2376459e6283c8 /tools
parent61b7b2ef64f8c9cf48ae1b0bfe2ee0bcb9bb3181 (diff)
downloadlinux-17d616b7d98dcc15561b83a7e1c78f304b8cea74.tar.xz
perf jevents: Add smi metric group for Intel models
Allow duplicated metric to be dropped from JSON files. Signed-off-by: Ian Rogers <irogers@google.com> Tested-by: Thomas Falcon <thomas.falcon@intel.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Benjamin Gray <bgray@linux.ibm.com> Cc: Caleb Biggers <caleb.biggers@intel.com> Cc: Edward Baker <edward.baker@intel.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: James Clark <james.clark@linaro.org> Cc: Jing Zhang <renyu.zj@linux.alibaba.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: John Garry <john.g.garry@oracle.com> Cc: Leo Yan <leo.yan@arm.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Perry Taylor <perry.taylor@intel.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Sandipan Das <sandipan.das@amd.com> Cc: Weilin Wang <weilin.wang@intel.com> Cc: Xu Yang <xu.yang_2@nxp.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/perf/pmu-events/intel_metrics.py24
1 files changed, 22 insertions, 2 deletions
diff --git a/tools/perf/pmu-events/intel_metrics.py b/tools/perf/pmu-events/intel_metrics.py
index 0cb7a38ad238..94604b1b07d8 100755
--- a/tools/perf/pmu-events/intel_metrics.py
+++ b/tools/perf/pmu-events/intel_metrics.py
@@ -3,9 +3,9 @@
import argparse
import math
import os
-from metric import (d_ratio, has_event, max, Event, JsonEncodeMetric,
+from metric import (d_ratio, has_event, max, CheckPmu, Event, JsonEncodeMetric,
JsonEncodeMetricGroupDescriptions, LoadEvents, Metric,
- MetricGroup, Select)
+ MetricGroup, MetricRef, Select)
# Global command line arguments.
_args = None
@@ -56,6 +56,25 @@ def Rapl() -> MetricGroup:
description="Running Average Power Limit (RAPL) power consumption estimates")
+def Smi() -> MetricGroup:
+ pmu = "<cpu_core or cpu_atom>" if CheckPmu("cpu_core") else "cpu"
+ aperf = Event('msr/aperf/')
+ cycles = Event('cycles')
+ smi_num = Event('msr/smi/')
+ smi_cycles = Select(Select((aperf - cycles) / aperf, smi_num > 0, 0),
+ has_event(aperf),
+ 0)
+ return MetricGroup('smi', [
+ Metric('smi_num', 'Number of SMI interrupts.',
+ Select(smi_num, has_event(smi_num), 0), 'SMI#'),
+ # Note, the smi_cycles "Event" is really a reference to the metric.
+ Metric('smi_cycles',
+ 'Percentage of cycles spent in System Management Interrupts. '
+ f'Requires /sys/bus/event_source/devices/{pmu}/freeze_on_smi to be 1.',
+ smi_cycles, '100%', threshold=(MetricRef('smi_cycles') > 0.10))
+ ], description='System Management Interrupt metrics')
+
+
def main() -> None:
global _args
@@ -83,6 +102,7 @@ def main() -> None:
all_metrics = MetricGroup("", [
Idle(),
Rapl(),
+ Smi(),
])
if _args.metricgroups: