summaryrefslogtreecommitdiffstats
path: root/tests/benchmarks/gui
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2020-04-17 11:43:38 +0200
committerEdward Welbourne <edward.welbourne@qt.io>2020-04-20 17:44:13 +0200
commit7202df3689f98a43462dc6411c4593153d300ccd (patch)
tree07baedaef03d5c5ddc0c7343eaf75c4d7980db5f /tests/benchmarks/gui
parent13873c6bc6e9514e4b6d4e11f7100863a439e33c (diff)
Replace QTime with QElapsedTimer in benchmarks
Various benchmarks were still using the deprecated timing API. One didn't even *use* the timer it implemented this way. One was just using start as a short-hand for assigning to currentTime(). Change-Id: If406d0fb606e454fec056f386bcd0aa6726ee96e Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'tests/benchmarks/gui')
-rw-r--r--tests/benchmarks/gui/painting/qtbench/tst_qtbench.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/tests/benchmarks/gui/painting/qtbench/tst_qtbench.cpp b/tests/benchmarks/gui/painting/qtbench/tst_qtbench.cpp
index c2ce15f720..fb5b2cdc91 100644
--- a/tests/benchmarks/gui/painting/qtbench/tst_qtbench.cpp
+++ b/tests/benchmarks/gui/painting/qtbench/tst_qtbench.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
@@ -29,6 +29,7 @@
#include <qtest.h>
#include <QtCore/qmath.h>
+#include <QtCore/QElapsedTimer>
#include <QtWidgets/QWidget>
#include "benchmarktests.h"
@@ -44,7 +45,7 @@ public:
qreal result() const { return m_result; }
public:
- QTime timer;
+ QElapsedTimer timer;
Benchmark *m_benchmark;
@@ -77,7 +78,7 @@ void BenchWidget::paintEvent(QPaintEvent *)
++m_iteration;
- uint currentElapsed = timer.isNull() ? 0 : timer.elapsed();
+ uint currentElapsed = timer.isValid() ? timer.elapsed() : 0;
timer.restart();
m_total += currentElapsed;