From eb4718a1f01bdecea9afed0ae5129491ef1b247c Mon Sep 17 00:00:00 2001
From: iximeow <me@iximeow.net>
Date: Tue, 2 Apr 2024 00:08:16 -0700
Subject: the name for instructions and cycles metrics from perf vary by kernel
 version

on midgard there is no :u suffix, so try both
---
 goodfile | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

(limited to 'goodfile')

diff --git a/goodfile b/goodfile
index f0031af..1b23c52 100644
--- a/goodfile
+++ b/goodfile
@@ -84,9 +84,16 @@ if Build.environment.has("perf") then
   measurements["decoded"] = tonumber(insts)
   measurements["elapsed_ms"] = tonumber(ms)
 
-  ipc = measurements["instructions:u"] / measurements["cycles:u"]
+  local instructions_name = "instructions:u"
+  local cycles_name = "cycles:u"
+  if measurements[instructions_name] == nil then
+    instructions_name = "instructions"
+    cycles_name = "cycles"
+  end
+
+  ipc = measurements[instructions_name] / measurements[cycles_name]
   Build.metric("no-fmt IPC", string.format("%.3f", ipc))
-  inst_per_decode = measurements["instructions:u"] / measurements["decoded"]
+  inst_per_decode = measurements[instructions_name] / measurements["decoded"]
   Build.metric("no-fmt instructions/decode", string.format("%.1f", inst_per_decode))
   ms_per_decode = measurements["elapsed_ms"] / measurements["decoded"]
   Build.metric("no-fmt ns/decode", string.format("%.2f", ms_per_decode * 1000000))
@@ -105,9 +112,9 @@ if Build.environment.has("perf") then
   measurements["decoded"] = tonumber(insts)
   measurements["elapsed_ms"] = tonumber(ms)
 
-  ipc = measurements["instructions:u"] / measurements["cycles:u"]
+  ipc = measurements[instructions_name] / measurements[cycles_name]
   Build.metric("fmt IPC", string.format("%.3f", ipc))
-  inst_per_decode = measurements["instructions:u"] / measurements["decoded"]
+  inst_per_decode = measurements[instructions_name] / measurements["decoded"]
   Build.metric("fmt instructions/decode", string.format("%.1f", inst_per_decode))
   ms_per_decode = measurements["elapsed_ms"] / measurements["decoded"]
   Build.metric("fmt ns/decode", string.format("%.2f", ms_per_decode * 1000000))
-- 
cgit v1.1