From 7af4a0381b766b238f151148bbb84cbf2b799b12 Mon Sep 17 00:00:00 2001 From: Ed Baker Date: Tue, 24 Oct 2023 13:48:42 -0700 Subject: [PATCH 1/2] do-not-commit: Testing FIXED core EventCode --- SKL/events/skylake_core.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/SKL/events/skylake_core.json b/SKL/events/skylake_core.json index fed87fcb..af2176a1 100644 --- a/SKL/events/skylake_core.json +++ b/SKL/events/skylake_core.json @@ -8,7 +8,7 @@ }, "Events": [ { - "EventCode": "0x00", + "EventCode": "FIXED", "UMask": "0x01", "EventName": "INST_RETIRED.ANY", "BriefDescription": "Instructions retired from execution.", @@ -31,7 +31,7 @@ "Deprecated": "0" }, { - "EventCode": "0x00", + "EventCode": "FIXED", "UMask": "0x02", "EventName": "CPU_CLK_UNHALTED.THREAD", "BriefDescription": "Core cycles when the thread is not in halt state", @@ -54,7 +54,7 @@ "Deprecated": "0" }, { - "EventCode": "0x00", + "EventCode": "FIXED", "UMask": "0x02", "EventName": "CPU_CLK_UNHALTED.THREAD_ANY", "BriefDescription": "Core cycles when at least one thread on the physical core is not in halt state.", @@ -77,7 +77,7 @@ "Deprecated": "0" }, { - "EventCode": "0x00", + "EventCode": "FIXED", "UMask": "0x03", "EventName": "CPU_CLK_UNHALTED.REF_TSC", "BriefDescription": "Reference cycles when the core is not in halt state.", From be3d331b4ad5376e630f3856a7fb0abd53ffd1f0 Mon Sep 17 00:00:00 2001 From: Ed Baker Date: Wed, 25 Oct 2023 10:02:47 -0700 Subject: [PATCH 2/2] create_perf_json: Support EventCode FIXED This commit unsets EventCode for FIXED events. Previously for fixed events the EventCode was 0x00. The get() helper used to process JSON attributes drops 0x00 (returns None). Here we add an extra check to also set event_code to None if EventCode is FIXED. Example FIXED event: { "EventCode": "FIXED", "UMask": "0x01", "EventName": "INST_RETIRED.ANY", "Counter": "Fixed counter 0", "CounterHTOff": "Fixed counter 0", "Offcore": "0", "Deprecated": "0" } --- scripts/create_perf_json.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scripts/create_perf_json.py b/scripts/create_perf_json.py index 88256a24..19b9c3a1 100644 --- a/scripts/create_perf_json.py +++ b/scripts/create_perf_json.py @@ -353,6 +353,14 @@ def get(key: str) -> str: self.event_code = "0xff" self.umask = None + # Unset event_code for fixed core counters. Example: + # "EventCode": "FIXED", + # "EventName": "INST_RETIRED.ANY", + # "Counter": "Fixed counter 0", + if "Counter" in jd and "fixed counter" in jd["Counter"].lower(): + if str(self.event_code).lower() == 'fixed': + self.event_code = None + if self.filter: remove_filter_start = [ "cbofilter",