diff --git a/benchmark_size.py b/benchmark_size.py index dfffd6ed..c2bd1ae1 100755 --- a/benchmark_size.py +++ b/benchmark_size.py @@ -9,6 +9,7 @@ # Contributor: Jeremy Bennett # Contributor: Roger Shepherd # Contributor: Konrad Moreon +# Contributor: Madhu Sudhanan # # This file is part of Embench. @@ -297,9 +298,13 @@ def collect_data(benchmarks): # Want relative results (the default). If baseline is zero, just # use 0.0 as the value. Note this is inverted compared to the # speed benchmark, so SMALL is good. - if baseline[bench] > 0: - rel_data[bench] = raw_totals[bench] / baseline[bench] - else: + try: + if baseline[bench] > 0: + rel_data[bench] = raw_totals[bench] / baseline[bench] + else: + rel_data[bench] = 0.0 + except KeyError: + log.error(f'Baseline data for {bench} not found. Assuming 0.') rel_data[bench] = 0.0 # Output it