Skip to content
Snippets Groups Projects
Commit 7cd7b7fc authored by ncteisen's avatar ncteisen
Browse files

Differentiate between timeouts and crashes

parent f1e19fdd
Branches
Tags
No related merge requests found
...@@ -51,7 +51,7 @@ def _median(ary): ...@@ -51,7 +51,7 @@ def _median(ary):
ary = sorted(ary) ary = sorted(ary)
n = len(ary) n = len(ary)
if n % 2 == 0: if n % 2 == 0:
return (ary[n / 2] + ary[n / 2 + 1]) / 2.0 return (ary[(n - 1) / 2] + ary[(n - 1) / 2 + 1]) / 2.0
else: else:
return ary[n / 2] return ary[n / 2]
...@@ -130,23 +130,30 @@ class Benchmark: ...@@ -130,23 +130,30 @@ class Benchmark:
return [self.final[f] if f in self.final else '' for f in flds] return [self.final[f] if f in self.final else '' for f in flds]
def _read_json(filename, badfiles): def _read_json(filename, badjson_files, nonexistant_files):
stripped = ".".join(filename.split(".")[:-2]) stripped = ".".join(filename.split(".")[:-2])
try: try:
with open(filename) as f: with open(filename) as f:
return json.loads(f.read()) return json.loads(f.read())
except IOError, e:
if stripped in nonexistant_files:
nonexistant_files[stripped] += 1
else:
nonexistant_files[stripped] = 1
return None
except ValueError, e: except ValueError, e:
if stripped in badfiles: if stripped in badjson_files:
badfiles[stripped] += 1 badjson_files[stripped] += 1
else: else:
badfiles[stripped] = 1 badjson_files[stripped] = 1
return None return None
def diff(bms, loops, track, old, new): def diff(bms, loops, track, old, new):
benchmarks = collections.defaultdict(Benchmark) benchmarks = collections.defaultdict(Benchmark)
badfiles = {} badjson_files = {}
nonexistant_files = {}
for bm in bms: for bm in bms:
for loop in range(0, loops): for loop in range(0, loops):
for line in subprocess.check_output( for line in subprocess.check_output(
...@@ -156,16 +163,16 @@ def diff(bms, loops, track, old, new): ...@@ -156,16 +163,16 @@ def diff(bms, loops, track, old, new):
"<", "_").replace(">", "_").replace(", ", "_") "<", "_").replace(">", "_").replace(", ", "_")
js_new_ctr = _read_json('%s.%s.counters.%s.%d.json' % js_new_ctr = _read_json('%s.%s.counters.%s.%d.json' %
(bm, stripped_line, new, loop), (bm, stripped_line, new, loop),
badfiles) badjson_files, nonexistant_files)
js_new_opt = _read_json('%s.%s.opt.%s.%d.json' % js_new_opt = _read_json('%s.%s.opt.%s.%d.json' %
(bm, stripped_line, new, loop), (bm, stripped_line, new, loop),
badfiles) badjson_files, nonexistant_files)
js_old_ctr = _read_json('%s.%s.counters.%s.%d.json' % js_old_ctr = _read_json('%s.%s.counters.%s.%d.json' %
(bm, stripped_line, old, loop), (bm, stripped_line, old, loop),
badfiles) badjson_files, nonexistant_files)
js_old_opt = _read_json('%s.%s.opt.%s.%d.json' % js_old_opt = _read_json('%s.%s.opt.%s.%d.json' %
(bm, stripped_line, old, loop), (bm, stripped_line, old, loop),
badfiles) badjson_files, nonexistant_files)
if js_new_ctr: if js_new_ctr:
for row in bm_json.expand_json(js_new_ctr, js_new_opt): for row in bm_json.expand_json(js_new_ctr, js_new_opt):
...@@ -191,7 +198,8 @@ def diff(bms, loops, track, old, new): ...@@ -191,7 +198,8 @@ def diff(bms, loops, track, old, new):
for name in sorted(benchmarks.keys()): for name in sorted(benchmarks.keys()):
if benchmarks[name].skip(): continue if benchmarks[name].skip(): continue
rows.append([name] + benchmarks[name].row(fields)) rows.append([name] + benchmarks[name].row(fields))
note = 'flakiness data = %s' % str(badfiles) note = 'Corrupt JSON data (indicates timeout or crash) = %s' % str(badjson_files)
note += '\n\nMissing files (new benchmark) = %s' % str(nonexistant_files)
if rows: if rows:
return tabulate.tabulate(rows, headers=headers, floatfmt='+.2f'), note return tabulate.tabulate(rows, headers=headers, floatfmt='+.2f'), note
else: else:
...@@ -204,4 +212,4 @@ if __name__ == '__main__': ...@@ -204,4 +212,4 @@ if __name__ == '__main__':
args.new) args.new)
print note print note
print "" print ""
print diff print diff if diff else "No performance differences"
...@@ -139,6 +139,8 @@ def main(args): ...@@ -139,6 +139,8 @@ def main(args):
text = 'Performance differences noted:\n' + diff text = 'Performance differences noted:\n' + diff
else: else:
text = 'No significant performance differences' text = 'No significant performance differences'
print note
print ""
print text print text
comment_on_pr.comment_on_pr('```\n%s\n\n%s\n```' % (note, text)) comment_on_pr.comment_on_pr('```\n%s\n\n%s\n```' % (note, text))
......
...@@ -107,8 +107,7 @@ def _collect_bm_data(bm, cfg, name, reps, idx, loops): ...@@ -107,8 +107,7 @@ def _collect_bm_data(bm, cfg, name, reps, idx, loops):
shortname='%s %s %s %s %d/%d' % (bm, line, cfg, name, idx + 1, shortname='%s %s %s %s %d/%d' % (bm, line, cfg, name, idx + 1,
loops), loops),
verbose_success=True, verbose_success=True,
timeout_seconds=60 * 10, timeout_seconds=60 * 2))
timeout_retries=3))
return jobs_list return jobs_list
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment