From 4112c0e9c3c6f9072f4f12f8f9a7f68b6d8f3792 Mon Sep 17 00:00:00 2001 From: Madhu Date: Tue, 21 May 2024 02:47:53 -0400 Subject: [PATCH 1/2] [fix]: KeyError exception due to missing baseline data --- benchmark_size.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/benchmark_size.py b/benchmark_size.py index dfffd6ed..61ff73b7 100755 --- a/benchmark_size.py +++ b/benchmark_size.py @@ -297,9 +297,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 From c77b5be0379a69e6c89d95ff1a9a48bebb1d4f63 Mon Sep 17 00:00:00 2001 From: madhu2000u <49570614+madhu2000u@users.noreply.github.com> Date: Tue, 21 May 2024 16:51:14 -0400 Subject: [PATCH 2/2] Update contributors list --- benchmark_size.py | 1 + 1 file changed, 1 insertion(+) diff --git a/benchmark_size.py b/benchmark_size.py index 61ff73b7..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.