diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2020-04-17 11:43:38 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2020-04-20 17:44:13 +0200 |
commit | 7202df3689f98a43462dc6411c4593153d300ccd (patch) | |
tree | 07baedaef03d5c5ddc0c7343eaf75c4d7980db5f /tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp | |
parent | 13873c6bc6e9514e4b6d4e11f7100863a439e33c (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/network/access/qnetworkreply/tst_qnetworkreply.cpp')
-rw-r--r-- | tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp index bcd354ebee..9b1f801044 100644 --- a/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/benchmarks/network/access/qnetworkreply/tst_qnetworkreply.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. @@ -31,6 +31,7 @@ #include <qtest.h> #include <QtTest/QtTest> #include <QtCore/qrandom.h> +#include <QtCore/QElapsedTimer> #include <QtNetwork/qnetworkreply.h> #include <QtNetwork/qnetworkrequest.h> #include <QtNetwork/qnetworkaccessmanager.h> @@ -93,7 +94,7 @@ protected: QEventLoop eventLoop; QTimer::singleShot(timeout, &eventLoop, SLOT(quit())); - QTime timer; + QElapsedTimer timer; timer.start(); eventLoop.exec(); disconnect(client, SIGNAL(bytesWritten(qint64)), this, 0); @@ -187,7 +188,7 @@ protected: DataReader reader(client, false); QObject::connect(client, SIGNAL(disconnected()), &eventLoop, SLOT(quit())); - QTime timer; + QElapsedTimer timer; timer.start(); eventLoop.exec(); qint64 elapsed = timer.elapsed(); @@ -280,7 +281,7 @@ protected: DataReader reader(client, false); QObject::connect(client, SIGNAL(disconnected()), &eventLoop, SLOT(quit())); - QTime timer; + QElapsedTimer timer; timer.start(); eventLoop.exec(); qint64 elapsed = timer.elapsed(); @@ -639,7 +640,7 @@ void tst_qnetworkreply::downloadPerformance() QNetworkReplyPtr reply(manager.get(request)); DataReader reader(reply, false); - QTime loopTime; + QElapsedTimer loopTime; connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); loopTime.start(); QTestEventLoop::instance().enterLoop(40); @@ -682,7 +683,7 @@ void tst_qnetworkreply::httpUploadPerformance() connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); - QTime time; + QElapsedTimer time; generator.start(); time.start(); QTestEventLoop::instance().enterLoop(40); @@ -710,7 +711,7 @@ void tst_qnetworkreply::performanceControlRate() sink.connectToHost("127.0.0.1", sender.serverPort()); DataReader reader(&sink, false); - QTime loopTime; + QElapsedTimer loopTime; connect(&sink, SIGNAL(disconnected()), &QTestEventLoop::instance(), SLOT(exitLoop())); loopTime.start(); QTestEventLoop::instance().enterLoop(40); @@ -748,7 +749,7 @@ void tst_qnetworkreply::httpDownloadPerformance() connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()), Qt::QueuedConnection); HttpDownloadPerformanceClient client(reply.data()); - QTime time; + QElapsedTimer time; time.start(); QTestEventLoop::instance().enterLoop(40); QCOMPARE(reply->error(), QNetworkReply::NoError); |