From 416e7d6fe0333ced4d76e15fe687bf5ee0061265 Mon Sep 17 00:00:00 2001 From: shortcutme Date: Mon, 25 Nov 2019 14:38:27 +0100 Subject: [PATCH] Fix too fast benchmark results statistics --- plugins/Benchmark/BenchmarkPlugin.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/Benchmark/BenchmarkPlugin.py b/plugins/Benchmark/BenchmarkPlugin.py index 3c588b6c..73b95d22 100644 --- a/plugins/Benchmark/BenchmarkPlugin.py +++ b/plugins/Benchmark/BenchmarkPlugin.py @@ -181,7 +181,7 @@ class ActionsPlugin: yield self.formatResult(time_taken, time_standard) yield "\n" res[key] = "ok" - multiplers.append(time_standard / time_taken) + multiplers.append(time_standard / max(time_taken, 0.001)) except Exception as err: res[key] = err yield "Failed!\n! Error: %s\n\n" % Debug.formatException(err) @@ -193,7 +193,7 @@ class ActionsPlugin: yield " - Total: %s tests\n" % len(res) yield " - Success: %s tests\n" % len([res_key for res_key, res_val in res.items() if res_val == "ok"]) yield " - Failed: %s tests\n" % len([res_key for res_key, res_val in res.items() if res_val != "ok"]) - if multiplers: + if any(multiplers): multipler_avg = sum(multiplers) / len(multiplers) multipler_title = self.getMultiplerTitle(multipler_avg) yield " - Average speed factor: %.2fx (%s)" % (multipler_avg, multipler_title)