import argparse
import collections
import os
+import fnmatch
-baseurl = "https://download.01.org/perfmon"
+baseurl = "https://raw.githubusercontent.com/intel/perfmon/main"
target_events = ('BR_INST_RETIRED.NEAR_TAKEN',
'BR_INST_EXEC.TAKEN',
def find_event(eventurl, model):
print("Downloading", eventurl, file = sys.stderr)
u = urllib.request.urlopen(eventurl)
- events = json.loads(u.read())
+ events = json.loads(u.read())["Events"]
u.close()
found = 0
cpufound = 0
for j in u:
n = j.rstrip().decode().split(',')
- if len(n) >= 4 and (args.all or n[0] == cpu) and n[3] == "core":
+ if len(n) >= 4 and (args.all or fnmatch.fnmatch(cpu, n[0])) and n[3] == "core":
components = n[0].split("-")
model = components[2]
model = int(model, 16)
model*:\ 37|\
model*:\ 44) E="cpu/event=0x88,umask=0x40/$FLAGS" ;;
model*:\ 55|\
+model*:\ 74|\
model*:\ 77|\
model*:\ 76|\
+model*:\ 90|\
model*:\ 92|\
model*:\ 95|\
model*:\ 87|\
model*:\ 166|\
model*:\ 85|\
model*:\ 85) E="cpu/event=0xC4,umask=0x20/p$FLAGS" ;;
+model*:\ 125|\
model*:\ 126|\
+model*:\ 167|\
model*:\ 140|\
model*:\ 141|\
model*:\ 143|\
+model*:\ 207|\
model*:\ 106|\
model*:\ 108) E="cpu/event=0xc4,umask=0x20/p$FLAGS" ;;
model*:\ 134|\
-model*:\ 150) E="cpu/event=0xc4,umask=0xfe/p$FLAGS" ;;
+model*:\ 150|\
+model*:\ 156|\
+model*:\ 190) E="cpu/event=0xc4,umask=0xfe/p$FLAGS" ;;
*)
echo >&2 "Unknown CPU. Run contrib/gen_autofdo_event.py --all --script to update script."
exit 1 ;;