diff --git a/qwt/tests/test_curvebenchmark1.py b/qwt/tests/test_curvebenchmark1.py index a180cc5..8032fa5 100644 --- a/qwt/tests/test_curvebenchmark1.py +++ b/qwt/tests/test_curvebenchmark1.py @@ -142,6 +142,7 @@ def __init__(self, max_n=1000000, parent=None, unattended=False, **kwargs): self.text = BMText(self) self.tabs.addTab(self.text, "Contents") self.resize(*self.SIZE) + self.durations = [] # Force window to show up and refresh (for test purpose only) self.show() @@ -160,7 +161,9 @@ def process_iteration(self, title, description, widget, t0): # Force widget to refresh (for test purpose only) QApplication.processEvents() - time_str = "Elapsed time: %d ms" % ((time.time() - t0) * 1000) + duration = (time.time() - t0) * 1000 + self.durations.append(duration) + time_str = "Elapsed time: %d ms" % duration widget.text.setText(time_str) self.text.append("
%s:
%s" % (description, time_str)) print("[%s] %s" % (utils.get_lib_versions(), time_str)) diff --git a/qwt/tests/test_loadtest.py b/qwt/tests/test_loadtest.py index 398fd2e..1576016 100644 --- a/qwt/tests/test_loadtest.py +++ b/qwt/tests/test_loadtest.py @@ -10,6 +10,8 @@ import time +import numpy as np + # Local imports from qwt.tests import test_curvebenchmark1 as cb from qwt.tests import utils @@ -47,6 +49,9 @@ def run_benchmark(self, max_n, unattended, **kwargs): symtext, ) self.process_iteration(title, description, widget, t0) + print("") + time_str = "Average elapsed time: %d ms" % np.mean(self.durations) + print("[%s] %s" % (utils.get_lib_versions(), time_str)) def test_loadtest():