Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-22 10:51:32

0001 // Copyright (C) 2016 The Qt Company Ltd.
0002 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
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 //  W A R N I N G
0018 //  -------------
0019 //
0020 // The QBenchmarkIterationController class is not a part of the
0021 // Qt Test API. It exists purely as an implementation detail.
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 // --- BEGIN public API ---
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 // --- END public API ---
0054 
0055 QT_END_NAMESPACE
0056 
0057 #endif // QBENCHMARK_H