[PATCH v1 09/13] perf jevents: Add uncore l3 metric group for AMD

Ian Rogers
2024-02-29T00:16:04Z

Metrics use the amd_l3 PMU for access/miss/hit information.

Signed-off-by: Ian Rogers <irogers@google.com>
---
tools/perf/pmu-events/amd_metrics.py | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)

diff --git a/tools/perf/pmu-events/amd_metrics.py b/tools/perf/pmu-events/amd_metrics.py
index be10acb40762..f4a4ece551ef 100755
--- a/tools/perf/pmu-events/amd_metrics.py
+++ b/tools/perf/pmu-events/amd_metrics.py
@@ -467,6 +467,23 @@ def Rapl() -> MetricGroup:
return MetricGroup("cpu_power", metrics,
description="Processor socket power consumption estimates")

+def UncoreL3():
+ acc = Event("l3_lookup_state.all_coherent_accesses_to_l3",
+ "l3_lookup_state.all_l3_req_typs")
+ miss = Event("l3_lookup_state.l3_miss",
+ "l3_comb_clstr_state.request_miss")
+ acc = max(acc, miss)
+ hits = acc - miss
+
+ return MetricGroup("l3", [
+ Metric("l3_accesses", "L3 victim cache accesses",
+ d_ratio(acc, interval_sec), "accesses/sec"),
+ Metric("l3_hits", "L3 victim cache hit rate", d_ratio(hits, acc), "100%"),
+ Metric("l3_miss", "L3 victim cache miss rate", d_ratio(miss, acc),
+ "100%"),
+ ], description="L3 cache breakdown per CCX")
+
+
all_metrics = MetricGroup("", [
AmdBr(),
AmdDtlb(),
@@ -476,6 +493,7 @@ all_metrics = MetricGroup("", [
AmdUpc(),
Idle(),
Rapl(),
+ UncoreL3(),
])

if args.metricgroups:
--
2.44.0.278.ge034bb2e1d-goog