1// Copyright (C) 2019 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QBENCHMARKMEASUREMENT_P_H
5#define QBENCHMARKMEASUREMENT_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtTest/qbenchmark.h>
19#include <QtCore/qlist.h>
20#include <QtCore/private/qglobal_p.h>
21
22QT_BEGIN_NAMESPACE
23
24class QBenchmarkMeasurerBase
25{
26public:
27 struct Measurement
28 {
29 qreal value;
30 QTest::QBenchmarkMetric metric;
31 };
32 virtual ~QBenchmarkMeasurerBase() = default;
33 virtual void init() {}
34 virtual void start() = 0;
35 virtual QList<Measurement> stop() = 0;
36 virtual bool isMeasurementAccepted(Measurement m) = 0;
37 virtual int adjustIterationCount(int suggestion) = 0;
38 virtual int adjustMedianCount(int suggestion) = 0;
39 virtual bool needsWarmupIteration() { return false; }
40};
41
42QT_END_NAMESPACE
43
44#endif // QBENCHMARKMEASUREMENT_P_H
45

source code of qtbase/src/testlib/qbenchmarkmeasurement_p.h