aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/profiling
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2017-04-25 08:27:31 -0700
committerGravatar Craig Tiller <ctiller@google.com>2017-04-25 08:44:56 -0700
commitc9c6aa7df0442a2861619a6403380350420871c4 (patch)
tree80559b4698c369cbb8ce855e8cc574be0b79cd23 /tools/profiling
parentb56dae554ca14dfd5a76690462b9efbc38314de0 (diff)
Be resilient against failed runs
Diffstat (limited to 'tools/profiling')
-rwxr-xr-xtools/profiling/microbenchmarks/bm_diff.py27
1 files changed, 16 insertions, 11 deletions
diff --git a/tools/profiling/microbenchmarks/bm_diff.py b/tools/profiling/microbenchmarks/bm_diff.py
index 6ee4cbfc7b..3c15478774 100755
--- a/tools/profiling/microbenchmarks/bm_diff.py
+++ b/tools/profiling/microbenchmarks/bm_diff.py
@@ -204,7 +204,10 @@ def eintr_be_gone(fn):
def read_json(filename):
- with open(filename) as f: return json.loads(f.read())
+ try:
+ with open(filename) as f: return json.loads(f.read())
+ except ValueError, e:
+ return None
def finalize():
@@ -217,16 +220,18 @@ def finalize():
js_old_ctr = read_json('%s.counters.old.%d.json' % (bm, loop))
js_old_opt = read_json('%s.opt.old.%d.json' % (bm, loop))
- for row in bm_json.expand_json(js_new_ctr, js_new_opt):
- print row
- name = row['cpp_name']
- if name.endswith('_mean') or name.endswith('_stddev'): continue
- benchmarks[name].add_sample(row, True)
- for row in bm_json.expand_json(js_old_ctr, js_old_opt):
- print row
- name = row['cpp_name']
- if name.endswith('_mean') or name.endswith('_stddev'): continue
- benchmarks[name].add_sample(row, False)
+ if js_new_ctr:
+ for row in bm_json.expand_json(js_new_ctr, js_new_opt):
+ print row
+ name = row['cpp_name']
+ if name.endswith('_mean') or name.endswith('_stddev'): continue
+ benchmarks[name].add_sample(row, True)
+ if js_old_ctr:
+ for row in bm_json.expand_json(js_old_ctr, js_old_opt):
+ print row
+ name = row['cpp_name']
+ if name.endswith('_mean') or name.endswith('_stddev'): continue
+ benchmarks[name].add_sample(row, False)
really_interesting = set()
for name, bm in benchmarks.items():