from enum import Enum
from typing import Dict, List, Optional, Set, Tuple, Union
+all_pmus = set()
all_events = set()
def LoadEvents(directory: str) -> None:
"""Populate a global set of all known events for the purpose of validating Event names"""
+ global all_pmus
global all_events
all_events = {
"context\\-switches",
if filename.endswith(".json"):
try:
for x in json.load(open(f"{directory}/{filename}")):
+ if "Unit" in x:
+ all_pmus.add(x["Unit"])
if "EventName" in x:
all_events.add(x["EventName"])
elif "ArchStdEvent" in x:
pass
+def CheckPmu(name: str) -> bool:
+ return name in all_pmus
+
+
def CheckEvent(name: str) -> bool:
"""Check the event name exists in the set of all loaded events"""
global all_events