File indexing completed on 2025-02-22 10:51:32
0001
0002
0003
0004 #ifndef QBENCHMARK_H
0005 #define QBENCHMARK_H
0006
0007 #include <QtTest/qttestglobal.h>
0008 #include <QtTest/qbenchmarkmetric.h>
0009
0010 QT_BEGIN_NAMESPACE
0011
0012
0013 namespace QTest
0014 {
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024 class Q_TESTLIB_EXPORT QBenchmarkIterationController
0025 {
0026 public:
0027 enum RunMode { RepeatUntilValidMeasurement, RunOnce };
0028 QBenchmarkIterationController();
0029 QBenchmarkIterationController(RunMode runMode);
0030 ~QBenchmarkIterationController();
0031 bool isDone() const noexcept;
0032 void next() noexcept;
0033 int i;
0034 };
0035
0036 }
0037
0038
0039
0040 #define QBENCHMARK \
0041 for (QTest::QBenchmarkIterationController _q_iteration_controller; \
0042 _q_iteration_controller.isDone() == false; _q_iteration_controller.next())
0043
0044 #define QBENCHMARK_ONCE \
0045 for (QTest::QBenchmarkIterationController _q_iteration_controller(QTest::QBenchmarkIterationController::RunOnce); \
0046 _q_iteration_controller.isDone() == false; _q_iteration_controller.next())
0047
0048 namespace QTest
0049 {
0050 void Q_TESTLIB_EXPORT setBenchmarkResult(qreal result, QBenchmarkMetric metric);
0051 }
0052
0053
0054
0055 QT_END_NAMESPACE
0056
0057 #endif