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 support for Num_CPUs aux value #105

Closed
wants to merge 3 commits into from
Closed
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
44 changes: 24 additions & 20 deletions scripts/create_perf_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -739,10 +739,24 @@ def find_form() -> Optional[str]:
"""Find the formula for CPU in the current CSV line."""
cell = field(tma_cpu)
if not cell:
for j in ratio_column[tma_cpu]:
cpu = tma_cpu
# BDW-DE is a BDW with the server
# uncore. Page_Walks_Utilization must come from
# the server BDX CPU.
if self.shortname == 'BDW-DE' and field('Level1') == 'Page_Walks_Utilization':
cpu = 'BDX'
for j in ratio_column[cpu]:
cell = field(j)
if cell:
break
# UNC_ARB is a BDW uncore PMU not present on
# BDW-DE, substitute for the BDX version.
if self.shortname == 'BDW-DE' and 'UNC_ARB' in cell:
for j in ratio_column['BDX']:
cell = field(j)
if cell:
break

if 'UNC_CLOCK.SOCKET' in cell and self.shortname in ['BDW-DE', 'TGL']:
cell = None
return cell
Expand Down Expand Up @@ -888,7 +902,7 @@ def is_topdown_row(key: str) -> bool:
form = find_form()
if form and form != '#NA':
aux_name = field('Level1')
assert aux_name.startswith('#')
assert aux_name.startswith('#') or aux_name == 'Num_CPUs'
aux[aux_name] = form
_verboseprint3(f'Adding aux {aux_name}: {form}')

Expand Down Expand Up @@ -930,10 +944,6 @@ def fixup(form: str) -> str:
'UNC_C_TOR_INSERTS.MISS_OPCODE@filter_opc\=0x182@'),
('UNC_C_CLOCKTICKS:one_unit', 'cbox_0@event\=0x0@'),
],
'BDW-DE': [
('UNC_ARB_COH_TRK_REQUESTS.ALL', 'arb@event\=0x84\,umask\=0x1@'),
('UNC_ARB_TRK_REQUESTS.ALL', 'arb@event\=0x81\,umask\=0x1@'),
],
'CLX': [
('UNC_M_CLOCKTICKS:one_unit', 'imc_0@event\=0x0@'),
('UNC_CHA_CLOCKTICKS:one_unit', 'cha_0@event\=0x0@'),
Expand Down Expand Up @@ -1089,8 +1099,11 @@ def bracket(expr):
return expr

def resolve_aux(v: str) -> str:
if any(v == i for i in ['#core_wide', '#Model', '#SMT_on', '#num_dies','#has_pmem']):
if any(v == i for i in ['#core_wide', '#Model', '#SMT_on', '#num_dies',
'#has_pmem', '#num_cpus_online']):
return v
if v == 'Num_CPUs':
return '#num_cpus_online'
if v == '#PMM_App_Direct':
return '#has_pmem > 0'
if v == '#DurationTimeInSeconds':
Expand Down Expand Up @@ -1136,7 +1149,7 @@ def resolve(v: str) -> str:
return expand_hhq(v[3:])
if v.startswith('##'):
return expand_hh(v[2:])
if v.startswith('#'):
if v.startswith('#') or v == 'Num_CPUs':
return resolve_aux(v)
return resolve_info(v)

Expand All @@ -1154,17 +1167,7 @@ def resolve(v: str) -> str:
def save_form(name, group, form, desc, locate, scale_unit, threshold,
issues):
if self.shortname == 'BDW-DE':
if name == 'Page_Walks_Utilization':
# Force in the BDX versions.
form = ('(ITLB_MISSES.WALK_DURATION + '
'DTLB_LOAD_MISSES.WALK_DURATION + '
'DTLB_STORE_MISSES.WALK_DURATION + 7 * '
'(DTLB_STORE_MISSES.WALK_COMPLETED + '
'DTLB_LOAD_MISSES.WALK_COMPLETED + '
'ITLB_MISSES.WALK_COMPLETED)) / (2 * CORE_CLKS)')
elif name in ['tma_false_sharing',
'tma_info_system_mem_parallel_requests',
'tma_info_system_mem_request_latency']:
if name in ['tma_false_sharing']:
# Uncore events missing for BDW-DE, so drop.
_verboseprint3(f'Dropping metric {name}')
return
Expand All @@ -1189,7 +1192,8 @@ def save_form(name, group, form, desc, locate, scale_unit, threshold,
'imc_0', 'uncore_cha_0', 'cbox_0', 'arb', 'cbox',
'num_packages', 'num_cores', 'SYSTEM_TSC_FREQ',
'filter_tid', 'TSC', 'cha', 'config1',
'source_count', 'slots', 'thresh', 'has_pmem']:
'source_count', 'slots', 'thresh', 'has_pmem',
'num_cpus_online']:
continue
if v.startswith('tma_') or v.startswith('topdown\\-'):
continue
Expand Down