Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
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
14void QBenchmarkTimeMeasurer::start()
15{
16 time.start();
17}
18
19QList<QBenchmarkMeasurerBase::Measurement> QBenchmarkTimeMeasurer::stop()
20{
21 return { { qreal(time.elapsed()), QTest::WalltimeMilliseconds } };
22}
23
24bool QBenchmarkTimeMeasurer::isMeasurementAccepted(Measurement measurement)
25{
26 return (measurement.value > 50);
27}
28
29int QBenchmarkTimeMeasurer::adjustIterationCount(int suggestion)
30{
31 return suggestion;
32}
33
34bool QBenchmarkTimeMeasurer::needsWarmupIteration()
35{
36 return true;
37}
38
39int QBenchmarkTimeMeasurer::adjustMedianCount(int)
40{
41 return 1;
42}
43
44#ifdef HAVE_TICK_COUNTER // defined in 3rdparty/cycle/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 { { qreal(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
80QT_END_NAMESPACE
Combined button and popup list for selecting options.