blob: 20c643b2c69fd42418f15ad55ec6b92ac894a8b3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QBENCHMARK_H
#define QBENCHMARK_H
#include <QtTest/qttestglobal.h>
#include <QtTest/qbenchmarkmetric.h>
QT_BEGIN_NAMESPACE
namespace QTest
{
//
// W A R N I N G
// -------------
//
// The QBenchmarkIterationController class is not a part of the
// Qt Test API. It exists purely as an implementation detail.
//
//
class Q_TESTLIB_EXPORT QBenchmarkIterationController
{
public:
enum RunMode { RepeatUntilValidMeasurement, RunOnce };
QBenchmarkIterationController();
QBenchmarkIterationController(RunMode runMode);
~QBenchmarkIterationController();
bool isDone();
void next();
int i;
};
}
// --- BEGIN public API ---
#define QBENCHMARK \
for (QTest::QBenchmarkIterationController _q_iteration_controller; \
_q_iteration_controller.isDone() == false; _q_iteration_controller.next())
#define QBENCHMARK_ONCE \
for (QTest::QBenchmarkIterationController _q_iteration_controller(QTest::QBenchmarkIterationController::RunOnce); \
_q_iteration_controller.isDone() == false; _q_iteration_controller.next())
namespace QTest
{
void Q_TESTLIB_EXPORT setBenchmarkResult(qreal result, QBenchmarkMetric metric);
}
// --- END public API ---
QT_END_NAMESPACE
#endif // QBENCHMARK_H
|