Break down UPI read and write bandwidth using uncore_upi counters.
Signed-off-by: Ian Rogers <irogers@google.com>
---
tools/perf/pmu-events/intel_metrics.py | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/tools/perf/pmu-events/intel_metrics.py b/tools/perf/pmu-events/intel_metrics.py
index 47e8f1166870..e639e8998d87 100755
--- a/tools/perf/pmu-events/intel_metrics.py
+++ b/tools/perf/pmu-events/intel_metrics.py
@@ -1009,6 +1009,27 @@ def UncoreMemBw() -> Optional[MetricGroup]:
], description = "Memory Bandwidth")
+def UncoreUpiBw() -> Optional[MetricGroup]:
+ try:
+ upi_rds = Event("UNC_UPI_RxL_FLITS.ALL_DATA")
+ upi_wrs = Event("UNC_UPI_TxL_FLITS.ALL_DATA")
+ except:
+ return None
+
+ upi_total = upi_rds + upi_wrs
+
+ # From "Uncore Performance Monitoring": When measuring the amount of
+ # bandwidth consumed by transmission of the data (i.e. NOT including
+ # the header), it should be .ALL_DATA / 9 * 64B.
+ scale = (64 / 9) / 1_000_000
+ return MetricGroup("lpm_upi_bw", [
+ Metric("lpm_upi_bw_read", "UPI read bandwidth",
+ d_ratio(upi_rds, interval_sec), f"{scale}MB/s"),
+ Metric("lpm_upi_bw_write", "DDR memory write bandwidth",
+ d_ratio(upi_wrs, interval_sec), f"{scale}MB/s"),
+ ], description = "UPI Bandwidth")
+
+
def main() -> None:
global _args
@@ -1050,6 +1071,7 @@ def main() -> None:
UncoreDir(),
UncoreMem(),
UncoreMemBw(),
+ UncoreUpiBw(),
])
--
2.51.0.338.gd7d06c2dae-goog