Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/testlib/qbenchmarkmeasurement.cpp |
Source code | Switch to Preprocessed file |
Line | Source | Count |
---|---|---|
1 | /**************************************************************************** | - |
2 | ** | - |
3 | ** Copyright (C) 2015 The Qt Company Ltd. | - |
4 | ** Contact: http://www.qt.io/licensing/ | - |
5 | ** | - |
6 | ** This file is part of the QtTest module of the Qt Toolkit. | - |
7 | ** | - |
8 | ** $QT_BEGIN_LICENSE:LGPL21$ | - |
9 | ** Commercial License Usage | - |
10 | ** Licensees holding valid commercial Qt licenses may use this file in | - |
11 | ** accordance with the commercial license agreement provided with the | - |
12 | ** Software or, alternatively, in accordance with the terms contained in | - |
13 | ** a written agreement between you and The Qt Company. For licensing terms | - |
14 | ** and conditions see http://www.qt.io/terms-conditions. For further | - |
15 | ** information use the contact form at http://www.qt.io/contact-us. | - |
16 | ** | - |
17 | ** GNU Lesser General Public License Usage | - |
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - |
19 | ** General Public License version 2.1 or version 3 as published by the Free | - |
20 | ** Software Foundation and appearing in the file LICENSE.LGPLv21 and | - |
21 | ** LICENSE.LGPLv3 included in the packaging of this file. Please review the | - |
22 | ** following information to ensure the GNU Lesser General Public License | - |
23 | ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and | - |
24 | ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | - |
25 | ** | - |
26 | ** As a special exception, The Qt Company gives you certain additional | - |
27 | ** rights. These rights are described in The Qt Company LGPL Exception | - |
28 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | - |
29 | ** | - |
30 | ** $QT_END_LICENSE$ | - |
31 | ** | - |
32 | ****************************************************************************/ | - |
33 | - | |
34 | #include <QtTest/private/qbenchmarkmeasurement_p.h> | - |
35 | #include <QtTest/private/qbenchmark_p.h> | - |
36 | #include <QtTest/private/qbenchmarkmetric_p.h> | - |
37 | #include <QtTest/qbenchmark.h> | - |
38 | #include <qdebug.h> | - |
39 | - | |
40 | QT_BEGIN_NAMESPACE | - |
41 | - | |
42 | // QBenchmarkTimeMeasurer implementation | - |
43 | - | |
44 | void QBenchmarkTimeMeasurer::start() | - |
45 | { | - |
46 | time.start(); | - |
47 | } executed 16 times by 1 test: end of block Executed by:
| 16 |
48 | - | |
49 | qint64 QBenchmarkTimeMeasurer::checkpoint() | - |
50 | { | - |
51 | return time.elapsed(); never executed: return time.elapsed(); | 0 |
52 | } | - |
53 | - | |
54 | qint64 QBenchmarkTimeMeasurer::stop() | - |
55 | { | - |
56 | return time.elapsed(); executed 16 times by 1 test: return time.elapsed(); Executed by:
| 16 |
57 | } | - |
58 | - | |
59 | bool QBenchmarkTimeMeasurer::isMeasurementAccepted(qint64 measurement) | - |
60 | { | - |
61 | return (measurement > 50); never executed: return (measurement > 50); | 0 |
62 | } | - |
63 | - | |
64 | int QBenchmarkTimeMeasurer::adjustIterationCount(int suggestion) | - |
65 | { | - |
66 | return suggestion; executed 130051 times by 535 tests: return suggestion; Executed by:
| 130051 |
67 | } | - |
68 | - | |
69 | bool QBenchmarkTimeMeasurer::needsWarmupIteration() | - |
70 | { | - |
71 | return true; executed 130043 times by 535 tests: return true; Executed by:
| 130043 |
72 | } | - |
73 | - | |
74 | int QBenchmarkTimeMeasurer::adjustMedianCount(int) | - |
75 | { | - |
76 | return 1; executed 16 times by 1 test: return 1; Executed by:
| 16 |
77 | } | - |
78 | - | |
79 | QTest::QBenchmarkMetric QBenchmarkTimeMeasurer::metricType() | - |
80 | { | - |
81 | return QTest::WalltimeMilliseconds; executed 16 times by 1 test: return QTest::WalltimeMilliseconds; Executed by:
| 16 |
82 | } | - |
83 | - | |
84 | #ifdef HAVE_TICK_COUNTER // defined in 3rdparty/cycle_p.h | - |
85 | - | |
86 | void QBenchmarkTickMeasurer::start() | - |
87 | { | - |
88 | startTicks = getticks(); | - |
89 | } never executed: end of block | 0 |
90 | - | |
91 | qint64 QBenchmarkTickMeasurer::checkpoint() | - |
92 | { | - |
93 | CycleCounterTicks now = getticks(); | - |
94 | return qRound64(elapsed(now, startTicks)); never executed: return qRound64(elapsed(now, startTicks)); | 0 |
95 | } | - |
96 | - | |
97 | qint64 QBenchmarkTickMeasurer::stop() | - |
98 | { | - |
99 | CycleCounterTicks now = getticks(); | - |
100 | return qRound64(elapsed(now, startTicks)); never executed: return qRound64(elapsed(now, startTicks)); | 0 |
101 | } | - |
102 | - | |
103 | bool QBenchmarkTickMeasurer::isMeasurementAccepted(qint64) | - |
104 | { | - |
105 | return true; never executed: return true; | 0 |
106 | } | - |
107 | - | |
108 | int QBenchmarkTickMeasurer::adjustIterationCount(int) | - |
109 | { | - |
110 | return 1; never executed: return 1; | 0 |
111 | } | - |
112 | - | |
113 | int QBenchmarkTickMeasurer::adjustMedianCount(int) | - |
114 | { | - |
115 | return 1; never executed: return 1; | 0 |
116 | } | - |
117 | - | |
118 | bool QBenchmarkTickMeasurer::needsWarmupIteration() | - |
119 | { | - |
120 | return true; never executed: return true; | 0 |
121 | } | - |
122 | - | |
123 | QTest::QBenchmarkMetric QBenchmarkTickMeasurer::metricType() | - |
124 | { | - |
125 | return QTest::CPUTicks; never executed: return QTest::CPUTicks; | 0 |
126 | } | - |
127 | - | |
128 | #endif | - |
129 | - | |
130 | - | |
131 | QT_END_NAMESPACE | - |
Source code | Switch to Preprocessed file |