Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qbenchmarkmeasurement.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 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#include <QtTest/private/qbenchmarktimemeasurers_p.h>
5#include <QtTest/private/qbenchmark_p.h>
6#include <QtTest/private/qbenchmarkmetric_p.h>
7#include <QtTest/qbenchmark.h>
8#include <qdebug.h>
9
11
12// QBenchmarkTimeMeasurer implementation
13
15{
16 time.start();
17}
18
19QList<QBenchmarkMeasurerBase::Measurement> QBenchmarkTimeMeasurer::stop()
20{
21 return { { qreal(time.elapsed()), QTest::WalltimeMilliseconds } };
22}
23
25{
26 return (measurement.value > 50);
27}
28
30{
31 return suggestion;
32}
33
35{
36 return true;
37}
38
40{
41 return 1;
42}
43
44#ifdef HAVE_TICK_COUNTER // defined in 3rdparty/cycle_p.h
45
46void QBenchmarkTickMeasurer::start()
47{
48 startTicks = getticks();
49}
50
51QList<QBenchmarkMeasurerBase::Measurement> QBenchmarkTickMeasurer::stop()
52{
53 CycleCounterTicks now = getticks();
54 return { { elapsed(now, startTicks), QTest::CPUTicks } };
55}
56
57bool QBenchmarkTickMeasurer::isMeasurementAccepted(QBenchmarkMeasurerBase::Measurement)
58{
59 return true;
60}
61
62int QBenchmarkTickMeasurer::adjustIterationCount(int)
63{
64 return 1;
65}
66
67int QBenchmarkTickMeasurer::adjustMedianCount(int)
68{
69 return 1;
70}
71
72bool QBenchmarkTickMeasurer::needsWarmupIteration()
73{
74 return true;
75}
76
77#endif
78
79
int adjustIterationCount(int sugestion) override
int adjustMedianCount(int suggestion) override
bool isMeasurementAccepted(Measurement measurement) override
QList< Measurement > stop() override
qint64 elapsed() const noexcept
Returns the number of milliseconds since this QElapsedTimer was last started.
void start() noexcept
\typealias QElapsedTimer::Duration Synonym for std::chrono::nanoseconds.
Combined button and popup list for selecting options.
@ WalltimeMilliseconds
static qint64 getticks()
static double elapsed(qint64 after, qint64 before)
double qreal
Definition qtypes.h:187