mirror of
https://github.com/google/benchmark.git
synced 2025-01-14 05:40:14 +08:00
Ensure all the necessary keys are present before parsing JSON data (#380)
This prevents errors when additional non-timing data are present in the JSON that is loaded, for example when complexity data has been computed (see #379).
This commit is contained in:
parent
3336ea00d8
commit
feb69ae710
@ -80,7 +80,9 @@ def generate_difference_report(json1, json2, use_color=True):
|
||||
first_line = "{:<{}s} Time CPU Old New".format(
|
||||
'Benchmark', first_col_width)
|
||||
output_strs = [first_line, '-' * len(first_line)]
|
||||
for bn in json1['benchmarks']:
|
||||
|
||||
gen = (bn for bn in json1['benchmarks'] if 'real_time' in bn and 'cpu_time' in bn)
|
||||
for bn in gen:
|
||||
other_bench = find_test(bn['name'])
|
||||
if not other_bench:
|
||||
continue
|
||||
|
Loading…
Reference in New Issue
Block a user