Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/testlib/qbenchmarkmetric.cpp |
Source code | Switch to Preprocessed file |
Line | Source | Count |
---|---|---|
1 | /**************************************************************************** | - |
2 | ** | - |
3 | ** Copyright (C) 2016 The Qt Company Ltd. | - |
4 | ** Copyright (C) 2016 Intel Corporation. | - |
5 | ** Contact: https://www.qt.io/licensing/ | - |
6 | ** | - |
7 | ** This file is part of the QtTest module of the Qt Toolkit. | - |
8 | ** | - |
9 | ** $QT_BEGIN_LICENSE:LGPL$ | - |
10 | ** Commercial License Usage | - |
11 | ** Licensees holding valid commercial Qt licenses may use this file in | - |
12 | ** accordance with the commercial license agreement provided with the | - |
13 | ** Software or, alternatively, in accordance with the terms contained in | - |
14 | ** a written agreement between you and The Qt Company. For licensing terms | - |
15 | ** and conditions see https://www.qt.io/terms-conditions. For further | - |
16 | ** information use the contact form at https://www.qt.io/contact-us. | - |
17 | ** | - |
18 | ** GNU Lesser General Public License Usage | - |
19 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - |
20 | ** General Public License version 3 as published by the Free Software | - |
21 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the | - |
22 | ** packaging of this file. Please review the following information to | - |
23 | ** ensure the GNU Lesser General Public License version 3 requirements | - |
24 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. | - |
25 | ** | - |
26 | ** GNU General Public License Usage | - |
27 | ** Alternatively, this file may be used under the terms of the GNU | - |
28 | ** General Public License version 2.0 or (at your option) the GNU General | - |
29 | ** Public license version 3 or any later version approved by the KDE Free | - |
30 | ** Qt Foundation. The licenses are as published by the Free Software | - |
31 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 | - |
32 | ** included in the packaging of this file. Please review the following | - |
33 | ** information to ensure the GNU General Public License requirements will | - |
34 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and | - |
35 | ** https://www.gnu.org/licenses/gpl-3.0.html. | - |
36 | ** | - |
37 | ** $QT_END_LICENSE$ | - |
38 | ** | - |
39 | ****************************************************************************/ | - |
40 | - | |
41 | #include <QtTest/private/qbenchmarkmetric_p.h> | - |
42 | - | |
43 | /*! | - |
44 | \enum QTest::QBenchmarkMetric | - |
45 | \since 4.7 | - |
46 | - | |
47 | This enum lists all the things that can be benchmarked. | - |
48 | - | |
49 | \value FramesPerSecond Frames per second | - |
50 | \value BitsPerSecond Bits per second | - |
51 | \value BytesPerSecond Bytes per second | - |
52 | \value WalltimeMilliseconds Clock time in milliseconds | - |
53 | \value WalltimeNanoseconds Clock time in nanoseconds | - |
54 | \value BytesAllocated Memory usage in bytes | - |
55 | \value Events Event count | - |
56 | \value CPUTicks CPU time | - |
57 | \value CPUMigrations Process migrations between CPUs | - |
58 | \value CPUCycles CPU cycles | - |
59 | \value BusCycles Bus cycles | - |
60 | \value StalledCycles Cycles stalled | - |
61 | \value InstructionReads Instruction reads | - |
62 | \value Instructions Instructions executed | - |
63 | \value BranchInstructions Branch-type instructions | - |
64 | \value BranchMisses Branch instructions that were mispredicted | - |
65 | \value CacheReferences Cache accesses of any type | - |
66 | \value CacheMisses Cache misses of any type | - |
67 | \value CacheReads Cache reads / loads | - |
68 | \value CacheReadMisses Cache read / load misses | - |
69 | \value CacheWrites Cache writes / stores | - |
70 | \value CacheWriteMisses Cache write / store misses | - |
71 | \value CachePrefetches Cache prefetches | - |
72 | \value CachePrefetchMisses Cache prefetch misses | - |
73 | \value ContextSwitches Context switches | - |
74 | \value PageFaults Page faults of any type | - |
75 | \value MinorPageFaults Minor page faults | - |
76 | \value MajorPageFaults Major page faults | - |
77 | \value AlignmentFaults Faults caused due to misalignment | - |
78 | \value EmulationFaults Faults that needed software emulation | - |
79 | - | |
80 | \sa QTest::benchmarkMetricName(), QTest::benchmarkMetricUnit() | - |
81 | - | |
82 | Note that \c WalltimeNanoseconds and \c BytesAllocated are | - |
83 | only provided for use via \l setBenchmarkResult(), and results | - |
84 | in those metrics are not able to be provided automatically | - |
85 | by the QTest framework. | - |
86 | */ | - |
87 | - | |
88 | /*! | - |
89 | \since 4.7 | - |
90 | Returns the enum value \a metric as a character string. | - |
91 | */ | - |
92 | const char * QTest::benchmarkMetricName(QBenchmarkMetric metric) | - |
93 | { | - |
94 | switch (metric) { | - |
95 | case FramesPerSecond: never executed: case FramesPerSecond: | 0 |
96 | return "FramesPerSecond"; never executed: return "FramesPerSecond"; | 0 |
97 | case BitsPerSecond: never executed: case BitsPerSecond: | 0 |
98 | return "BitsPerSecond"; never executed: return "BitsPerSecond"; | 0 |
99 | case BytesPerSecond: never executed: case BytesPerSecond: | 0 |
100 | return "BytesPerSecond"; never executed: return "BytesPerSecond"; | 0 |
101 | case WalltimeMilliseconds: never executed: case WalltimeMilliseconds: | 0 |
102 | return "WalltimeMilliseconds"; never executed: return "WalltimeMilliseconds"; | 0 |
103 | case Events: executed 240 times by 1 test: case Events: Executed by:
| 240 |
104 | return "Events"; executed 240 times by 1 test: return "Events"; Executed by:
| 240 |
105 | case CPUTicks: never executed: case CPUTicks: | 0 |
106 | return "CPUTicks"; never executed: return "CPUTicks"; | 0 |
107 | case CPUMigrations: never executed: case CPUMigrations: | 0 |
108 | return "CPUMigrations"; never executed: return "CPUMigrations"; | 0 |
109 | case CPUCycles: never executed: case CPUCycles: | 0 |
110 | return "CPUCycles"; never executed: return "CPUCycles"; | 0 |
111 | case BusCycles: never executed: case BusCycles: | 0 |
112 | return "BusCycles"; never executed: return "BusCycles"; | 0 |
113 | case StalledCycles: never executed: case StalledCycles: | 0 |
114 | return "StalledCycles"; never executed: return "StalledCycles"; | 0 |
115 | case InstructionReads: never executed: case InstructionReads: | 0 |
116 | return "InstructionReads"; never executed: return "InstructionReads"; | 0 |
117 | case Instructions: never executed: case Instructions: | 0 |
118 | return "Instructions"; never executed: return "Instructions"; | 0 |
119 | case WalltimeNanoseconds: never executed: case WalltimeNanoseconds: | 0 |
120 | return "WalltimeNanoseconds"; never executed: return "WalltimeNanoseconds"; | 0 |
121 | case BytesAllocated: never executed: case BytesAllocated: | 0 |
122 | return "BytesAllocated"; never executed: return "BytesAllocated"; | 0 |
123 | case BranchInstructions: never executed: case BranchInstructions: | 0 |
124 | return "BranchInstructions"; never executed: return "BranchInstructions"; | 0 |
125 | case BranchMisses: never executed: case BranchMisses: | 0 |
126 | return "BranchMisses"; never executed: return "BranchMisses"; | 0 |
127 | case CacheReferences: never executed: case CacheReferences: | 0 |
128 | return "CacheReferences"; never executed: return "CacheReferences"; | 0 |
129 | case CacheReads: never executed: case CacheReads: | 0 |
130 | return "CacheReads"; never executed: return "CacheReads"; | 0 |
131 | case CacheWrites: never executed: case CacheWrites: | 0 |
132 | return "CacheWrites"; never executed: return "CacheWrites"; | 0 |
133 | case CachePrefetches: never executed: case CachePrefetches: | 0 |
134 | return "CachePrefetches"; never executed: return "CachePrefetches"; | 0 |
135 | case CacheMisses: never executed: case CacheMisses: | 0 |
136 | return "CacheMisses"; never executed: return "CacheMisses"; | 0 |
137 | case CacheReadMisses: never executed: case CacheReadMisses: | 0 |
138 | return "CacheReadMisses"; never executed: return "CacheReadMisses"; | 0 |
139 | case CacheWriteMisses: never executed: case CacheWriteMisses: | 0 |
140 | return "CacheWriteMisses"; never executed: return "CacheWriteMisses"; | 0 |
141 | case CachePrefetchMisses: never executed: case CachePrefetchMisses: | 0 |
142 | return "CachePrefetchMisses"; never executed: return "CachePrefetchMisses"; | 0 |
143 | case ContextSwitches: never executed: case ContextSwitches: | 0 |
144 | return "ContextSwitches"; never executed: return "ContextSwitches"; | 0 |
145 | case PageFaults: never executed: case PageFaults: | 0 |
146 | return "PageFaults"; never executed: return "PageFaults"; | 0 |
147 | case MinorPageFaults: never executed: case MinorPageFaults: | 0 |
148 | return "MinorPageFaults"; never executed: return "MinorPageFaults"; | 0 |
149 | case MajorPageFaults: never executed: case MajorPageFaults: | 0 |
150 | return "MajorPageFaults"; never executed: return "MajorPageFaults"; | 0 |
151 | case AlignmentFaults: never executed: case AlignmentFaults: | 0 |
152 | return "AlignmentFaults"; never executed: return "AlignmentFaults"; | 0 |
153 | case EmulationFaults: never executed: case EmulationFaults: | 0 |
154 | return "EmulationFaults"; never executed: return "EmulationFaults"; | 0 |
155 | default: never executed: default: | 0 |
156 | return ""; never executed: return ""; | 0 |
157 | } | - |
158 | }; | - |
159 | - | |
160 | /*! | - |
161 | \since 4.7 | - |
162 | Retuns the units of measure for the specified \a metric. | - |
163 | */ | - |
164 | const char * QTest::benchmarkMetricUnit(QBenchmarkMetric metric) | - |
165 | { | - |
166 | switch (metric) { | - |
167 | case FramesPerSecond: never executed: case FramesPerSecond: | 0 |
168 | return "fps"; never executed: return "fps"; | 0 |
169 | case BitsPerSecond: never executed: case BitsPerSecond: | 0 |
170 | return "bits/s"; never executed: return "bits/s"; | 0 |
171 | case BytesPerSecond: never executed: case BytesPerSecond: | 0 |
172 | return "bytes/s"; never executed: return "bytes/s"; | 0 |
173 | case WalltimeMilliseconds: executed 8 times by 1 test: case WalltimeMilliseconds: Executed by:
| 8 |
174 | return "msecs"; executed 8 times by 1 test: return "msecs"; Executed by:
| 8 |
175 | case Events: executed 86 times by 1 test: case Events: Executed by:
| 86 |
176 | return "events"; executed 86 times by 1 test: return "events"; Executed by:
| 86 |
177 | case CPUTicks: never executed: case CPUTicks: | 0 |
178 | return "CPU ticks"; never executed: return "CPU ticks"; | 0 |
179 | case CPUMigrations: never executed: case CPUMigrations: | 0 |
180 | return "CPU migrations"; never executed: return "CPU migrations"; | 0 |
181 | case CPUCycles: never executed: case CPUCycles: | 0 |
182 | return "CPU cycles"; never executed: return "CPU cycles"; | 0 |
183 | case BusCycles: never executed: case BusCycles: | 0 |
184 | return "bus cycles"; never executed: return "bus cycles"; | 0 |
185 | case StalledCycles: never executed: case StalledCycles: | 0 |
186 | return "stalled cycles"; never executed: return "stalled cycles"; | 0 |
187 | case InstructionReads: never executed: case InstructionReads: | 0 |
188 | return "instruction reads"; never executed: return "instruction reads"; | 0 |
189 | case Instructions: never executed: case Instructions: | 0 |
190 | return "instructions"; never executed: return "instructions"; | 0 |
191 | case WalltimeNanoseconds: never executed: case WalltimeNanoseconds: | 0 |
192 | return "nsecs"; never executed: return "nsecs"; | 0 |
193 | case BytesAllocated: never executed: case BytesAllocated: | 0 |
194 | return "bytes"; never executed: return "bytes"; | 0 |
195 | case BranchInstructions: never executed: case BranchInstructions: | 0 |
196 | return "branch instructions"; never executed: return "branch instructions"; | 0 |
197 | case BranchMisses: never executed: case BranchMisses: | 0 |
198 | return "branch misses"; never executed: return "branch misses"; | 0 |
199 | case CacheReferences: never executed: case CacheReferences: | 0 |
200 | return "cache references"; never executed: return "cache references"; | 0 |
201 | case CacheReads: never executed: case CacheReads: | 0 |
202 | return "cache loads"; never executed: return "cache loads"; | 0 |
203 | case CacheWrites: never executed: case CacheWrites: | 0 |
204 | return "cache stores"; never executed: return "cache stores"; | 0 |
205 | case CachePrefetches: never executed: case CachePrefetches: | 0 |
206 | return "cache prefetches"; never executed: return "cache prefetches"; | 0 |
207 | case CacheMisses: never executed: case CacheMisses: | 0 |
208 | return "cache misses"; never executed: return "cache misses"; | 0 |
209 | case CacheReadMisses: never executed: case CacheReadMisses: | 0 |
210 | return "cache load misses"; never executed: return "cache load misses"; | 0 |
211 | case CacheWriteMisses: never executed: case CacheWriteMisses: | 0 |
212 | return "cache store misses"; never executed: return "cache store misses"; | 0 |
213 | case CachePrefetchMisses: never executed: case CachePrefetchMisses: | 0 |
214 | return "cache prefetch misses"; never executed: return "cache prefetch misses"; | 0 |
215 | case ContextSwitches: never executed: case ContextSwitches: | 0 |
216 | return "context switches"; never executed: return "context switches"; | 0 |
217 | case PageFaults: never executed: case PageFaults: | 0 |
218 | return "page faults"; never executed: return "page faults"; | 0 |
219 | case MinorPageFaults: never executed: case MinorPageFaults: | 0 |
220 | return "minor page faults"; never executed: return "minor page faults"; | 0 |
221 | case MajorPageFaults: never executed: case MajorPageFaults: | 0 |
222 | return "major page faults"; never executed: return "major page faults"; | 0 |
223 | case AlignmentFaults: never executed: case AlignmentFaults: | 0 |
224 | return "alignment faults"; never executed: return "alignment faults"; | 0 |
225 | case EmulationFaults: never executed: case EmulationFaults: | 0 |
226 | return "emulation faults"; never executed: return "emulation faults"; | 0 |
227 | default: never executed: default: | 0 |
228 | return ""; never executed: return ""; | 0 |
229 | } | - |
230 | } | - |
231 | - | |
Source code | Switch to Preprocessed file |