Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tpebs retire latency mean as default value in event JSON files #173

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions scripts/create_perf_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,7 @@ def __init__(self, shortname: str, longname: str, version: str,
@param version: the version number associated with the event json.
@param models: a set of model indentifier strings like "GenuineIntel-6-2E".
@param files: a mapping from a type of file to the file's path.
@param retire_lat_dict: event default retire latency value.
"""
self.shortname = shortname
self.longname = longname.lower()
Expand All @@ -519,6 +520,7 @@ def __init__(self, shortname: str, longname: str, version: str,
self.files = files
self.metricgroups = {}
self.unit_counters = {}
self.retire_lat_dict = self.load_retire_lat_db()

def __lt__(self, other: 'Model') -> bool:
""" Sort by models gloally by name."""
Expand Down Expand Up @@ -558,6 +560,19 @@ def mapfile_line(self) -> str:
ret += f',{self.version.lower()},{self.longname},core'
return ret

def load_retire_lat_db(self):
"""
Load default retire latency value from JSON file and return a dict.
"""
if 'retire_lat' not in self.files:
return None
retire_lat_dict = {}
with open(self.files['retire_lat'], 'r') as retire_lat_json:
json_data = json.load(retire_lat_json)
json_data = json_data['Data']
retire_lat_dict = {e:json_data[e][0] for e in json_data.keys()}
return retire_lat_dict

def cstate_json(self):
cstates = [
(['NHM', 'WSM'], [3, 6], [3, 6, 7]),
Expand Down Expand Up @@ -1624,6 +1639,14 @@ def count_counters(self, event_type, pmon_events):
self.unit_counters[unit] = {'Unit':unit, 'CountersNumFixed': '0', 'CountersNumGeneric': '0'}
self.unit_counters[unit][type] = v

def add_retire_lat(self, dict_event):
if not self.retire_lat_dict:
return
name = dict_event['EventName']
if name in self.retire_lat_dict and "MEAN" in self.retire_lat_dict[name]:
# Use MEAN only for now
dict_event['RetireLatencyMean'] = self.retire_lat_dict[name]["MEAN"]

def to_perf_json(self, outdir: Path):
# Map from a topic to its list of events as dictionaries.
pmon_topic_events: Dict[str, list[Dict[str, str]]] = \
Expand Down Expand Up @@ -1672,6 +1695,7 @@ def to_perf_json(self, outdir: Path):
dict_event['Unit'] = unit
if per_pkg:
dict_event['PerPkg'] = per_pkg
self.add_retire_lat(dict_event)
pmon_topic_events[event.topic].append(dict_event)
dict_events[event.event_name] = dict_event
events[event.event_name] = event
Expand Down Expand Up @@ -1929,6 +1953,14 @@ def __init__(self, base_path: Path):
if shortname in ['BDX', 'CLX', 'HSX', 'ICX', 'SKX', 'SPR']:
raise

retire_lat_path = Path(base_path, shortname, 'events',
f'{longname.lower()}_retire_latency.json')
if retire_lat_path.is_file():
_verboseprint2(f'Found {retire_lat_path}')
files[shortname]['retire_lat'] = retire_lat_path
else:
_verboseprint2(f'Didn\'t find {retire_lat_path}')

self.archs += [
Model(shortname, longname, versions[shortname], models[shortname], files[shortname])
]
Expand Down
Loading