Skip to content

Commit a0f1cc1

Browse files
weilinwanamhyung
authored andcommitted
perf test: Add skip list for metrics known would fail
Add skip list for metrics known would fail because some of the metrics are very likely to fail due to multiplexing or other errors. So add all of the flaky tests into the skip list. Signed-off-by: Weilin Wang <weilin.wang@intel.com> Tested-by: Namhyung Kim <namhyung@kernel.org> Cc: ravi.bangoria@amd.com Cc: Ian Rogers <irogers@google.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Caleb Biggers <caleb.biggers@intel.com> Cc: Perry Taylor <perry.taylor@intel.com> Cc: Samantha Alt <samantha.alt@intel.com> Cc: Arnaldo Carvalho de Melo <acme@kernel.org> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Kan Liang <kan.liang@linux.intel.com> Cc: Ingo Molnar <mingo@redhat.com> Link: https://lore.kernel.org/r/20230620170027.1861012-3-weilin.wang@intel.com Signed-off-by: Namhyung Kim <namhyung@kernel.org>
1 parent 3ad7092 commit a0f1cc1

2 files changed

Lines changed: 38 additions & 4 deletions

File tree

tools/perf/tests/shell/lib/perf_metric_validation.py

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def __init__(self, rulefname, reportfname='', t=5, debug=False, datafname='', fu
1212
self.reportfname = reportfname
1313
self.rules = None
1414
self.collectlist=metrics
15-
self.metrics = set()
15+
self.metrics = set(metrics)
1616
self.tolerance = t
1717

1818
self.workloads = [x for x in workload.split(",") if x]
@@ -148,6 +148,7 @@ def pos_val_test(self):
148148
self.errlist.append("Metric '%s' is not collected"%(name))
149149
elif val < 0:
150150
negmetric.add("{0}(={1:.4f})".format(name, val))
151+
self.collectlist[0].append(name)
151152
else:
152153
pcnt += 1
153154
tcnt += 1
@@ -266,6 +267,7 @@ def single_test(self, rule:dict):
266267
passcnt += 1
267268
else:
268269
faillist.append({'MetricName':m['Name'], 'CollectedValue':result})
270+
self.collectlist[0].append(m['Name'])
269271

270272
self.totalcnt += totalcnt
271273
self.passedcnt += passcnt
@@ -348,17 +350,20 @@ def collect_perf(self, data_file: str, workload: str):
348350
if rule["TestType"] == "RelationshipTest":
349351
metrics = [m["Name"] for m in rule["Metrics"]]
350352
if not any(m not in collectlist[0] for m in metrics):
351-
collectlist[rule["RuleIndex"]] = set(metrics)
353+
collectlist[rule["RuleIndex"]] = [",".join(list(set(metrics)))]
352354

353355
for idx, metrics in collectlist.items():
354356
if idx == 0: wl = "sleep 0.5".split()
355357
else: wl = workload.split()
356358
for metric in metrics:
357359
command = [tool, 'stat', '-j', '-M', f"{metric}", "-a"]
358360
command.extend(wl)
361+
print(" ".join(command))
359362
cmd = subprocess.run(command, stderr=subprocess.PIPE, encoding='utf-8')
360363
data = [x+'}' for x in cmd.stderr.split('}\n') if x]
361364
self.convert(data, idx)
365+
self.collectlist = dict()
366+
self.collectlist[0] = list()
362367
# End of Collector and Converter
363368

364369
# Start of Rule Generator
@@ -386,6 +391,20 @@ def parse_perf_metrics(self):
386391

387392
return
388393

394+
def remove_unsupported_rules(self, rules, skiplist: set = None):
395+
for m in skiplist:
396+
self.metrics.discard(m)
397+
new_rules = []
398+
for rule in rules:
399+
add_rule = True
400+
for m in rule["Metrics"]:
401+
if m["Name"] not in self.metrics:
402+
add_rule = False
403+
break
404+
if add_rule:
405+
new_rules.append(rule)
406+
return new_rules
407+
389408
def create_rules(self):
390409
"""
391410
Create full rules which includes:
@@ -394,7 +413,10 @@ def create_rules(self):
394413
395414
Reindex all the rules to avoid repeated RuleIndex
396415
"""
397-
self.rules = self.read_json(self.rulefname)['RelationshipRules']
416+
data = self.read_json(self.rulefname)
417+
rules = data['RelationshipRules']
418+
skiplist = set(data['SkipList'])
419+
self.rules = self.remove_unsupported_rules(rules, skiplist)
398420
pctgrule = {'RuleIndex':0,
399421
'TestType':'SingleMetricTest',
400422
'RangeLower':'0',
@@ -453,7 +475,8 @@ def test(self):
453475
454476
The final report is written into a JSON file.
455477
'''
456-
self.parse_perf_metrics()
478+
if not self.collectlist:
479+
self.parse_perf_metrics()
457480
self.create_rules()
458481
for i in range(0, len(self.workloads)):
459482
self._init_data()

tools/perf/tests/shell/lib/perf_metric_validation_rules.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
11
{
2+
"SkipList": [
3+
"tsx_aborted_cycles",
4+
"tsx_transactional_cycles",
5+
"C2_Pkg_Residency",
6+
"C6_Pkg_Residency",
7+
"C1_Core_Residency",
8+
"C6_Core_Residency",
9+
"tma_false_sharing",
10+
"tma_remote_cache",
11+
"tma_contested_accesses"
12+
],
213
"RelationshipRules": [
314
{
415
"RuleIndex": 1,

0 commit comments

Comments
 (0)