1
0
mirror of https://github.com/google/benchmark.git synced 2025-04-30 06:50:27 +08:00

Ensure all the necessary keys are present before parsing JSON data ()

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 ).
This commit is contained in:
Felix Duvallet 2017-05-02 17:19:35 +02:00 committed by Dominic Hamon
parent 3336ea00d8
commit feb69ae710

View File

@ -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