in perfrunbook/utilities/measure_aggregated_pmu_stats.py [0:0]
def get_cpu_type():
GRAVITON_MAPPING = {
"0xd0c": "Graviton2",
"0xd40": "Graviton3",
"0xd4f": "Graviton4"
}
AMD_MAPPING = {
"7R13": "Milan",
"9R14": "Genoa"
}
with open("/proc/cpuinfo", "r") as f:
for line in f.readlines():
if "model name" in line:
ln = line.split(":")[-1].strip()
if "AMD EPYC" in ln:
# Return the model number of the AMD CPU, its the 3rd entry in format
# AMD EPYC <model>
return AMD_MAPPING[ln.split(" ")[2]]
else:
return ln
elif "CPU part" in line:
cpu = line.split(":")[-1].strip()
return GRAVITON_MAPPING[cpu]