perf_json_generator fails when used on rainier.json
I tried running perf_json_generator for https://github.com/ARM-software/data/blob/master/pmu/rainier.json and get the following error because the new Morello performance counters are not handled by categories.json
file_name = topic + '.json'
~~~~~~^~~~~~~~~
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
Possible patch (not sure if this is the right workaround):
commit ff224de867123bb94d567dda56915c483cad1164 (HEAD -> main)
Author: Alex Richardson <alexrichardson@google.com>
Date: Tue Aug 22 10:08:58 2023 -0700
perf_json_generate: fall back to a 'other' category when none match
This avoids crashing when trying to convert the rainier.json file to the
pmu-events format:
diff --git a/tools/perf_json_generator/categorise.py b/tools/perf_json_generator/categorise.py
index a64cf5e..b4350b6 100755
--- a/tools/perf_json_generator/categorise.py
+++ b/tools/perf_json_generator/categorise.py
@@ -41,6 +41,10 @@ class ArmDataEventGrouper(EventGrouper):
if regex_group and specific_group:
print(f"{event_name} matches a regular expression and has a specific group entry",
file=sys.stderr)
+ if regex_group is None and specific_group is None:
+ print(f"{event_name} does not match any category, please update categories.json",
+ file=sys.stderr)
+ return ['other']
return [specific_group or regex_group]