diff options
Diffstat (limited to 'tests/benchmarks')
-rw-r--r-- | tests/benchmarks/CMakeLists.txt | 7 | ||||
-rw-r--r-- | tests/benchmarks/README | 81 | ||||
-rw-r--r-- | tests/benchmarks/qgeoareamonitorinfo/CMakeLists.txt | 12 | ||||
-rw-r--r-- | tests/benchmarks/qgeoareamonitorinfo/tst_bench_qgeoareamonitorinfo.cpp | 255 | ||||
-rw-r--r-- | tests/benchmarks/qgeopositioninfo/CMakeLists.txt | 12 | ||||
-rw-r--r-- | tests/benchmarks/qgeopositioninfo/tst_bench_qgeopositioninfo.cpp | 253 | ||||
-rw-r--r-- | tests/benchmarks/qgeosatelliteinfo/CMakeLists.txt | 12 | ||||
-rw-r--r-- | tests/benchmarks/qgeosatelliteinfo/tst_bench_qgeosatelliteinfo.cpp | 248 |
8 files changed, 0 insertions, 880 deletions
diff --git a/tests/benchmarks/CMakeLists.txt b/tests/benchmarks/CMakeLists.txt deleted file mode 100644 index 941ba9da..00000000 --- a/tests/benchmarks/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -# special case begin - -add_subdirectory(qgeoareamonitorinfo) -add_subdirectory(qgeopositioninfo) -add_subdirectory(qgeosatelliteinfo) - -# special case end diff --git a/tests/benchmarks/README b/tests/benchmarks/README deleted file mode 100644 index 8d017cd9..00000000 --- a/tests/benchmarks/README +++ /dev/null @@ -1,81 +0,0 @@ -The most reliable way of running benchmarks is to do it in an otherwise idle -system. On a busy system, the results will vary according to the other tasks -demanding attention in the system. - -We have managed to obtain quite reliable results by doing the following on -Linux (and you need root): - - - switching the scheduler to a Real-Time mode - - setting the processor affinity to one single processor - - disabling the other thread of the same core - -This should work rather well for CPU-intensive tasks. A task that is in Real- -Time mode will simply not be preempted by the OS. But if you make OS syscalls, -especially I/O ones, your task will be de-scheduled. Note that this includes -page faults, so if you can, make sure your benchmark's warmup code paths touch -most of the data. - -To do this you need a tool called schedtool (package schedtool), from -http://freequaos.host.sk/schedtool/ - -From this point on, we are using CPU0 for all tasks: - -If you have a Hyperthreaded multi-core processor (Core-i5 and Core-i7), you -have to disable the other thread of the same core as CPU0. To discover which -one it is: - -$ cat /sys/devices/system/cpu/cpu0/topology/thread_siblings_list - -This will print something like 0,4, meaning that CPUs 0 and 4 are sibling -threads on the same core. So we'll turn CPU 4 off: - -(as root) -# echo 0 > /sys/devices/system/cpu/cpu4/online - -To turn it back on, echo 1 into the same file. - -To run a task on CPU 0 exclusively, using FIFO RT priority 10, you run the -following: - -(as root) -# schedtool -F -p 10 -a 1 -e ./taskname - -For example: -# schedtool -F -p 10 -a 1 -e ./tst_bench_qstring -tickcounter - -Warning: if your task livelocks or takes far too long to complete, your system -may be unusable for a long time, especially if you don't have other cores to -run stuff on. To prevent that, run it before schedtool and time it. - -You can also limit the CPU time that the task is allowed to take. Run in the -same shell as you'll run schedtool: - -$ ulimit -s 300 -To limit to 300 seconds (5 minutes) - -If your task runs away, it will get a SIGXCPU after consuming 5 minutes of CPU -time (5 minutes running at 100%). - -If your app is multithreaded, you may want to give it more CPUs, like CPU0 and -CPU1 with -a 3 (it's a bitmask). - -For best results, you should disable ALL other cores and threads of the same -processor. The new Core-i7 have one processor with 4 cores, -each core can run 2 threads; the older Mac Pros have two processors with 4 -cores each. So on those Mac Pros, you'd disable cores 1, 2 and 3, while on the -Core-i7, you'll need to disable all other CPUs. - -However, disabling just the sibling thread seems to produce very reliable -results for me already, with variance often below 0.5% (even though there are -some measurable spikes). - -Other things to try: - -Running the benchmark with highest priority, i.e. "sudo nice -19" -usually produces stable results on some machines. If the benchmark also -involves displaying something on the screen (on X11), running it with -"-sync" is a must. Though, in that case the "real" cost is not correct, -but it is useful to discover regressions. - -Also; not many people know about ionice (1) - ionice - get/set program io scheduling class and priority diff --git a/tests/benchmarks/qgeoareamonitorinfo/CMakeLists.txt b/tests/benchmarks/qgeoareamonitorinfo/CMakeLists.txt deleted file mode 100644 index f384baaf..00000000 --- a/tests/benchmarks/qgeoareamonitorinfo/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -# special case begin - -qt_internal_add_benchmark(tst_bench_qgeoareamonitorinfo - SOURCES - tst_bench_qgeoareamonitorinfo.cpp - PUBLIC_LIBRARIES - Qt::Core - Qt::Positioning - Qt::Test -) - -# special case end diff --git a/tests/benchmarks/qgeoareamonitorinfo/tst_bench_qgeoareamonitorinfo.cpp b/tests/benchmarks/qgeoareamonitorinfo/tst_bench_qgeoareamonitorinfo.cpp deleted file mode 100644 index 0e332ea7..00000000 --- a/tests/benchmarks/qgeoareamonitorinfo/tst_bench_qgeoareamonitorinfo.cpp +++ /dev/null @@ -1,255 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2021 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QtPositioning/QGeoAreaMonitorInfo> -#include <QtPositioning/QGeoCircle> -#include <QTest> - -static const QDateTime expirationTime = QDateTime::currentDateTimeUtc().addSecs(60); -static const QGeoCircle area = QGeoCircle(QGeoCoordinate(1.0, 1.0), 100); - -class tst_QGeoAreaMonitorInfoBenchmark : public QObject -{ - Q_OBJECT -private slots: - void construct(); - void constructCopy(); - void constructMove(); - - void assign(); - void assignMove(); - - void checkEquality(); - - void setName(); - void queryName(); - - void queryIdentifier(); - void isValid(); - - void setArea(); - void queryArea(); - - void setExpiration(); - void queryExpiration(); - - void setPersistent(); - void queryPersistent(); - - void setNotificationParameters(); - void queryNotificationParameters(); -}; - - - -void tst_QGeoAreaMonitorInfoBenchmark::construct() -{ - QBENCHMARK { - QGeoAreaMonitorInfo info("test"); - Q_UNUSED(info) - } -} - -static QGeoAreaMonitorInfo createAreaMonitorInfo() -{ - QGeoAreaMonitorInfo info("test"); - info.setExpiration(expirationTime); - info.setArea(area); - QVariantMap parameters; - parameters["key"] = "value"; - parameters["another_key"] = true; - info.setNotificationParameters(parameters); - return info; -} - -void tst_QGeoAreaMonitorInfoBenchmark::constructCopy() -{ - const auto info = createAreaMonitorInfo(); - QBENCHMARK { - QGeoAreaMonitorInfo newInfo(info); - Q_UNUSED(newInfo) - } -} - -void tst_QGeoAreaMonitorInfoBenchmark::constructMove() -{ - QBENCHMARK { - // We need to create a new object at each iteration, so that we don't - // end up moving an already moved-from object. So the real value for - // move can be calculated using the results of construct() - // benchmark. - QGeoAreaMonitorInfo info("test"); - QGeoAreaMonitorInfo newInfo(std::move(info)); - Q_UNUSED(newInfo) - } -} - -void tst_QGeoAreaMonitorInfoBenchmark::assign() -{ - const auto info = createAreaMonitorInfo(); - QGeoAreaMonitorInfo newInfo; - QBENCHMARK { - newInfo = info; - } -} - -void tst_QGeoAreaMonitorInfoBenchmark::assignMove() -{ - QGeoAreaMonitorInfo newInfo; - QBENCHMARK { - // We need to create a new object at each iteration, so that we don't - // end up moving an already moved-from object. So the real value for - // move can be calculated using the results of construct() - // benchmark. - QGeoAreaMonitorInfo info("test"); - newInfo = std::move(info); - } -} - -void tst_QGeoAreaMonitorInfoBenchmark::checkEquality() -{ - const auto info1 = createAreaMonitorInfo(); - const auto info2 = createAreaMonitorInfo(); - QBENCHMARK { - const bool equal = info1 == info2; - Q_UNUSED(equal) - } -} - -void tst_QGeoAreaMonitorInfoBenchmark::setName() -{ - auto info = createAreaMonitorInfo(); - // Setting the name twice, as there is a check for same name. - // Ideally need to divide the result of the benchmark by 2. - QBENCHMARK { - info.setName("name1"); - info.setName("name2"); - } -} - -void tst_QGeoAreaMonitorInfoBenchmark::queryName() -{ - const auto info = createAreaMonitorInfo(); - QBENCHMARK { - const auto val = info.name(); - Q_UNUSED(val) - } -} - -void tst_QGeoAreaMonitorInfoBenchmark::queryIdentifier() -{ - const auto info = createAreaMonitorInfo(); - QBENCHMARK { - const auto val = info.identifier(); - Q_UNUSED(val) - } -} - -void tst_QGeoAreaMonitorInfoBenchmark::isValid() -{ - const auto info = createAreaMonitorInfo(); - QBENCHMARK { - const auto val = info.isValid(); - Q_UNUSED(val) - } -} - -void tst_QGeoAreaMonitorInfoBenchmark::setArea() -{ - auto info = createAreaMonitorInfo(); - QBENCHMARK { - info.setArea(area); - } -} - -void tst_QGeoAreaMonitorInfoBenchmark::queryArea() -{ - const auto info = createAreaMonitorInfo(); - QBENCHMARK { - const auto val = info.area(); - Q_UNUSED(val) - } -} - -void tst_QGeoAreaMonitorInfoBenchmark::setExpiration() -{ - auto info = createAreaMonitorInfo(); - QBENCHMARK { - info.setExpiration(expirationTime); - } -} - -void tst_QGeoAreaMonitorInfoBenchmark::queryExpiration() -{ - const auto info = createAreaMonitorInfo(); - QBENCHMARK { - const auto val = info.expiration(); - Q_UNUSED(val) - } -} - -void tst_QGeoAreaMonitorInfoBenchmark::setPersistent() -{ - auto info = createAreaMonitorInfo(); - QBENCHMARK { - info.setPersistent(true); - } -} - -void tst_QGeoAreaMonitorInfoBenchmark::queryPersistent() -{ - const auto info = createAreaMonitorInfo(); - QBENCHMARK { - const auto val = info.isPersistent(); - Q_UNUSED(val) - } -} - -void tst_QGeoAreaMonitorInfoBenchmark::setNotificationParameters() -{ - auto info = createAreaMonitorInfo(); - QVariantMap newParameters; - newParameters["key"] = "value1"; - newParameters["another_key"] = false; - QBENCHMARK { - info.setNotificationParameters(newParameters); - } -} - -void tst_QGeoAreaMonitorInfoBenchmark::queryNotificationParameters() -{ - const auto info = createAreaMonitorInfo(); - QBENCHMARK { - const auto val = info.notificationParameters(); - Q_UNUSED(val) - } -} - -QTEST_MAIN(tst_QGeoAreaMonitorInfoBenchmark) - -#include "tst_bench_qgeoareamonitorinfo.moc" diff --git a/tests/benchmarks/qgeopositioninfo/CMakeLists.txt b/tests/benchmarks/qgeopositioninfo/CMakeLists.txt deleted file mode 100644 index 40ba0246..00000000 --- a/tests/benchmarks/qgeopositioninfo/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -# special case begin - -qt_internal_add_benchmark(tst_bench_qgeopositioninfo - SOURCES - tst_bench_qgeopositioninfo.cpp - PUBLIC_LIBRARIES - Qt::Core - Qt::Positioning - Qt::Test -) - -# special case end diff --git a/tests/benchmarks/qgeopositioninfo/tst_bench_qgeopositioninfo.cpp b/tests/benchmarks/qgeopositioninfo/tst_bench_qgeopositioninfo.cpp deleted file mode 100644 index eabc6b62..00000000 --- a/tests/benchmarks/qgeopositioninfo/tst_bench_qgeopositioninfo.cpp +++ /dev/null @@ -1,253 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2021 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QtPositioning/QGeoPositionInfo> -#include <QTest> - -static const QGeoCoordinate coordinate(1.0, 2.0); -static const QDateTime dateTime = QDateTime::currentDateTimeUtc(); - -class tst_QGeoPositionInfoBenchmark : public QObject -{ - Q_OBJECT -private slots: - void constructDefault(); - void constructWithParameters(); - void constructCopy(); - void constructMove(); - - void assign(); - void assignMove(); - - void checkEquality(); - - void isValid(); - - void setTimestamp(); - void queryTimestamp(); - - void setCoordinate(); - void queryCoordinate(); - - void setAttribute(); - void queryAttributeExisting(); - void queryAttributeNonExisting(); - void removeAttributeExisting(); - void removeAttributeNonExisting(); - void hasAttributeExisting(); - void hasAttributeNonExisting(); -}; - -void tst_QGeoPositionInfoBenchmark::constructDefault() -{ - QBENCHMARK { - QGeoPositionInfo info; - Q_UNUSED(info) - } -} - -void tst_QGeoPositionInfoBenchmark::constructWithParameters() -{ - QBENCHMARK { - QGeoPositionInfo info(coordinate, dateTime); - Q_UNUSED(info) - } -} - -void tst_QGeoPositionInfoBenchmark::constructCopy() -{ - const QGeoPositionInfo info(coordinate, dateTime); - QBENCHMARK { - QGeoPositionInfo newInfo(info); - Q_UNUSED(newInfo) - } -} - -void tst_QGeoPositionInfoBenchmark::constructMove() -{ - QBENCHMARK { - // We need to create a new object at each iteration, so that we don't - // end up moving an already moved-from object. So the real value for - // move can be calculated using the results of constructDefault() - // benchmark. - QGeoPositionInfo info; - QGeoPositionInfo newInfo(std::move(info)); - Q_UNUSED(newInfo) - } -} - -void tst_QGeoPositionInfoBenchmark::assign() -{ - const QGeoPositionInfo info(coordinate, dateTime); - QGeoPositionInfo newInfo; - QBENCHMARK { - newInfo = info; - } -} - -void tst_QGeoPositionInfoBenchmark::assignMove() -{ - QGeoPositionInfo newInfo; - QBENCHMARK { - // We need to create a new object at each iteration, so that we don't - // end up moving an already moved-from object. So the real value for - // move can be calculated using the results of constructDefault() - // benchmark. - QGeoPositionInfo info; - newInfo = std::move(info); - } -} - -void tst_QGeoPositionInfoBenchmark::checkEquality() -{ - // We will benchmark equal objects, because unequal objects will normally - // take less time to compare (as the comparison will fail at some stage). - const QGeoPositionInfo info1(coordinate, dateTime); - const QGeoPositionInfo info2(coordinate, dateTime); - QBENCHMARK { - const bool equal = info1 == info2; - Q_UNUSED(equal) - } -} - -void tst_QGeoPositionInfoBenchmark::isValid() -{ - const QGeoPositionInfo info(coordinate, dateTime); - QBENCHMARK { - const bool valid = info.isValid(); - Q_UNUSED(valid) - } -} - -void tst_QGeoPositionInfoBenchmark::setTimestamp() -{ - QGeoPositionInfo info; - QBENCHMARK { - info.setTimestamp(dateTime); - } -} - -void tst_QGeoPositionInfoBenchmark::queryTimestamp() -{ - const QGeoPositionInfo info(coordinate, dateTime); - QBENCHMARK { - const auto dt = info.timestamp(); - Q_UNUSED(dt) - } -} - -void tst_QGeoPositionInfoBenchmark::setCoordinate() -{ - QGeoPositionInfo info; - QBENCHMARK { - info.setCoordinate(coordinate); - } -} - -void tst_QGeoPositionInfoBenchmark::queryCoordinate() -{ - const QGeoPositionInfo info(coordinate, dateTime); - QBENCHMARK { - const auto coord = info.coordinate(); - Q_UNUSED(coord) - } -} - -void tst_QGeoPositionInfoBenchmark::setAttribute() -{ - QGeoPositionInfo info; - QBENCHMARK { - info.setAttribute(QGeoPositionInfo::Direction, 1.0); - } -} - -static QGeoPositionInfo generateInfoWithAttributes() -{ - QGeoPositionInfo info; - info.setAttribute(QGeoPositionInfo::Direction, 1.0); - info.setAttribute(QGeoPositionInfo::GroundSpeed, 2.0); - info.setAttribute(QGeoPositionInfo::VerticalSpeed, 3.0); - info.setAttribute(QGeoPositionInfo::MagneticVariation, 4.0); - return info; -} - -void tst_QGeoPositionInfoBenchmark::queryAttributeExisting() -{ - QGeoPositionInfo info = generateInfoWithAttributes(); - QBENCHMARK { - const auto value = info.attribute(QGeoPositionInfo::GroundSpeed); - Q_UNUSED(value) - } -} - -void tst_QGeoPositionInfoBenchmark::queryAttributeNonExisting() -{ - QGeoPositionInfo info = generateInfoWithAttributes(); - QBENCHMARK { - const auto value = info.attribute(QGeoPositionInfo::HorizontalAccuracy); - Q_UNUSED(value) - } -} - -void tst_QGeoPositionInfoBenchmark::removeAttributeExisting() -{ - QGeoPositionInfo info = generateInfoWithAttributes(); - QBENCHMARK { - info.removeAttribute(QGeoPositionInfo::GroundSpeed); - } -} - -void tst_QGeoPositionInfoBenchmark::removeAttributeNonExisting() -{ - QGeoPositionInfo info = generateInfoWithAttributes(); - QBENCHMARK { - info.removeAttribute(QGeoPositionInfo::HorizontalAccuracy); - } -} - -void tst_QGeoPositionInfoBenchmark::hasAttributeExisting() -{ - QGeoPositionInfo info = generateInfoWithAttributes(); - QBENCHMARK { - const auto value = info.hasAttribute(QGeoPositionInfo::GroundSpeed); - Q_UNUSED(value) - } -} - -void tst_QGeoPositionInfoBenchmark::hasAttributeNonExisting() -{ - QGeoPositionInfo info = generateInfoWithAttributes(); - QBENCHMARK { - const auto value = info.hasAttribute(QGeoPositionInfo::HorizontalAccuracy); - Q_UNUSED(value) - } -} - -QTEST_MAIN(tst_QGeoPositionInfoBenchmark) - -#include "tst_bench_qgeopositioninfo.moc" diff --git a/tests/benchmarks/qgeosatelliteinfo/CMakeLists.txt b/tests/benchmarks/qgeosatelliteinfo/CMakeLists.txt deleted file mode 100644 index 461bcf66..00000000 --- a/tests/benchmarks/qgeosatelliteinfo/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -# special case begin - -qt_internal_add_benchmark(tst_bench_qgeosatelliteinfo - SOURCES - tst_bench_qgeosatelliteinfo.cpp - PUBLIC_LIBRARIES - Qt::Core - Qt::Positioning - Qt::Test -) - -# special case end diff --git a/tests/benchmarks/qgeosatelliteinfo/tst_bench_qgeosatelliteinfo.cpp b/tests/benchmarks/qgeosatelliteinfo/tst_bench_qgeosatelliteinfo.cpp deleted file mode 100644 index acff7a7b..00000000 --- a/tests/benchmarks/qgeosatelliteinfo/tst_bench_qgeosatelliteinfo.cpp +++ /dev/null @@ -1,248 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2021 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <QtPositioning/QGeoSatelliteInfo> -#include <QTest> - -class tst_QGeoSatelliteInfoBenchmark : public QObject -{ - Q_OBJECT -private slots: - void constructDefault(); - void constructCopy(); - void constructMove(); - - void assign(); - void assignMove(); - - void checkEquality(); - - void setSatelliteSystem(); - void querySatelliteSystem(); - - void setSatelliteIdentifier(); - void querySatelliteIdentifier(); - - void setSignalStrength(); - void querySignalStrength(); - - void setAttribute(); - void queryAttributeExisting(); - void queryAttributeNonExisting(); - void removeAttributeExisting(); - void removeAttributeNonExisting(); - void hasAttributeExisting(); - void hasAttributeNonExisting(); -}; - -void tst_QGeoSatelliteInfoBenchmark::constructDefault() -{ - QBENCHMARK { - QGeoSatelliteInfo info; - Q_UNUSED(info) - } -} - -static QGeoSatelliteInfo createSatelliteInfo() -{ - QGeoSatelliteInfo info; - info.setSatelliteSystem(QGeoSatelliteInfo::GLONASS); - info.setSatelliteIdentifier(1); - info.setSignalStrength(-30); - info.setAttribute(QGeoSatelliteInfo::Elevation, 10.0); - return info; -} - -void tst_QGeoSatelliteInfoBenchmark::constructCopy() -{ - const auto info = createSatelliteInfo(); - QBENCHMARK { - QGeoSatelliteInfo newInfo(info); - Q_UNUSED(newInfo) - } -} - -void tst_QGeoSatelliteInfoBenchmark::constructMove() -{ - QBENCHMARK { - // We need to create a new object at each iteration, so that we don't - // end up moving an already moved-from object. So the real value for - // move can be calculated using the results of constructDefault() - // benchmark. - QGeoSatelliteInfo info; - QGeoSatelliteInfo newInfo(std::move(info)); - Q_UNUSED(newInfo) - } -} - -void tst_QGeoSatelliteInfoBenchmark::assign() -{ - const auto info = createSatelliteInfo(); - QGeoSatelliteInfo newInfo; - QBENCHMARK { - newInfo = info; - } -} - -void tst_QGeoSatelliteInfoBenchmark::assignMove() -{ - QGeoSatelliteInfo newInfo; - QBENCHMARK { - // We need to create a new object at each iteration, so that we don't - // end up moving an already moved-from object. So the real value for - // move can be calculated using the results of constructDefault() - // benchmark. - QGeoSatelliteInfo info; - newInfo = std::move(info); - } -} - -void tst_QGeoSatelliteInfoBenchmark::checkEquality() -{ - const auto info1 = createSatelliteInfo(); - const auto info2 = createSatelliteInfo(); - QBENCHMARK { - const bool equal = info1 == info2; - Q_UNUSED(equal) - } -} - -void tst_QGeoSatelliteInfoBenchmark::setSatelliteSystem() -{ - QGeoSatelliteInfo info; - QBENCHMARK { - info.setSatelliteSystem(QGeoSatelliteInfo::GPS); - } -} - -void tst_QGeoSatelliteInfoBenchmark::querySatelliteSystem() -{ - const auto info = createSatelliteInfo(); - QBENCHMARK { - const auto val = info.satelliteSystem(); - Q_UNUSED(val) - } -} - -void tst_QGeoSatelliteInfoBenchmark::setSatelliteIdentifier() -{ - QGeoSatelliteInfo info; - QBENCHMARK { - info.setSatelliteIdentifier(10); - } -} - -void tst_QGeoSatelliteInfoBenchmark::querySatelliteIdentifier() -{ - const auto info = createSatelliteInfo(); - QBENCHMARK { - const auto val = info.satelliteIdentifier(); - Q_UNUSED(val) - } -} - -void tst_QGeoSatelliteInfoBenchmark::setSignalStrength() -{ - QGeoSatelliteInfo info; - QBENCHMARK { - info.setSignalStrength(-50); - } -} - -void tst_QGeoSatelliteInfoBenchmark::querySignalStrength() -{ - const auto info = createSatelliteInfo(); - QBENCHMARK { - const auto val = info.signalStrength(); - Q_UNUSED(val) - } -} - -void tst_QGeoSatelliteInfoBenchmark::setAttribute() -{ - QGeoSatelliteInfo info; - QBENCHMARK { - info.setAttribute(QGeoSatelliteInfo::Elevation, 10.0); - } -} - -void tst_QGeoSatelliteInfoBenchmark::queryAttributeExisting() -{ - const auto info = createSatelliteInfo(); - QBENCHMARK { - const auto val = info.attribute(QGeoSatelliteInfo::Elevation); - Q_UNUSED(val) - } -} - -void tst_QGeoSatelliteInfoBenchmark::queryAttributeNonExisting() -{ - const auto info = createSatelliteInfo(); - QBENCHMARK { - const auto val = info.attribute(QGeoSatelliteInfo::Azimuth); - Q_UNUSED(val) - } -} - -void tst_QGeoSatelliteInfoBenchmark::removeAttributeExisting() -{ - auto info = createSatelliteInfo(); - QBENCHMARK { - info.removeAttribute(QGeoSatelliteInfo::Elevation); - } -} - -void tst_QGeoSatelliteInfoBenchmark::removeAttributeNonExisting() -{ - auto info = createSatelliteInfo(); - QBENCHMARK { - info.removeAttribute(QGeoSatelliteInfo::Azimuth); - } -} - -void tst_QGeoSatelliteInfoBenchmark::hasAttributeExisting() -{ - auto info = createSatelliteInfo(); - QBENCHMARK { - const auto val = info.hasAttribute(QGeoSatelliteInfo::Elevation); - Q_UNUSED(val) - } -} - -void tst_QGeoSatelliteInfoBenchmark::hasAttributeNonExisting() -{ - auto info = createSatelliteInfo(); - QBENCHMARK { - const auto val = info.hasAttribute(QGeoSatelliteInfo::Azimuth); - Q_UNUSED(val) - } -} - -QTEST_MAIN(tst_QGeoSatelliteInfoBenchmark) - -#include "tst_bench_qgeosatelliteinfo.moc" |