| 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) 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/qbenchmarkmetric_p.h> | - |
| 35 | - | |
| 36 | /*! | - |
| 37 | \enum QTest::QBenchmarkMetric | - |
| 38 | \since 4.7 | - |
| 39 | - | |
| 40 | This enum lists all the things that can be benchmarked. | - |
| 41 | - | |
| 42 | \value FramesPerSecond Frames per second | - |
| 43 | \value BitsPerSecond Bits per second | - |
| 44 | \value BytesPerSecond Bytes per second | - |
| 45 | \value WalltimeMilliseconds Clock time in milliseconds | - |
| 46 | \value WalltimeNanoseconds Clock time in nanoseconds | - |
| 47 | \value BytesAllocated Memory usage in bytes | - |
| 48 | \value Events Event count | - |
| 49 | \value CPUTicks CPU time | - |
| 50 | \value CPUMigrations Process migrations between CPUs | - |
| 51 | \value CPUCycles CPU cycles | - |
| 52 | \value BusCycles Bus cycles | - |
| 53 | \value StalledCycles Cycles stalled | - |
| 54 | \value InstructionReads Instruction reads | - |
| 55 | \value Instructions Instructions executed | - |
| 56 | \value BranchInstructions Branch-type instructions | - |
| 57 | \value BranchMisses Branch instructions that were mispredicted | - |
| 58 | \value CacheReferences Cache accesses of any type | - |
| 59 | \value CacheMisses Cache misses of any type | - |
| 60 | \value CacheReads Cache reads / loads | - |
| 61 | \value CacheReadMisses Cache read / load misses | - |
| 62 | \value CacheWrites Cache writes / stores | - |
| 63 | \value CacheWriteMisses Cache write / store misses | - |
| 64 | \value CachePrefetches Cache prefetches | - |
| 65 | \value CachePrefetchMisses Cache prefetch misses | - |
| 66 | \value ContextSwitches Context switches | - |
| 67 | \value PageFaults Page faults of any type | - |
| 68 | \value MinorPageFaults Minor page faults | - |
| 69 | \value MajorPageFaults Major page faults | - |
| 70 | \value AlignmentFaults Faults caused due to misalignment | - |
| 71 | \value EmulationFaults Faults that needed software emulation | - |
| 72 | - | |
| 73 | \sa QTest::benchmarkMetricName(), QTest::benchmarkMetricUnit() | - |
| 74 | - | |
| 75 | Note that \c WalltimeNanoseconds and \c BytesAllocated are | - |
| 76 | only provided for use via \l setBenchmarkResult(), and results | - |
| 77 | in those metrics are not able to be provided automatically | - |
| 78 | by the QTest framework. | - |
| 79 | */ | - |
| 80 | - | |
| 81 | /*! | - |
| 82 | \since 4.7 | - |
| 83 | Returns the enum value \a metric as a character string. | - |
| 84 | */ | - |
| 85 | const char * QTest::benchmarkMetricName(QBenchmarkMetric metric) | - |
| 86 | { | - |
| 87 | switch (metric) { | - |
| 88 | case FramesPerSecond: never executed: case FramesPerSecond: | 0 |
| 89 | return "FramesPerSecond"; never executed: return "FramesPerSecond"; | 0 |
| 90 | case BitsPerSecond: never executed: case BitsPerSecond: | 0 |
| 91 | return "BitsPerSecond"; never executed: return "BitsPerSecond"; | 0 |
| 92 | case BytesPerSecond: never executed: case BytesPerSecond: | 0 |
| 93 | return "BytesPerSecond"; never executed: return "BytesPerSecond"; | 0 |
| 94 | case WalltimeMilliseconds: never executed: case WalltimeMilliseconds: | 0 |
| 95 | return "WalltimeMilliseconds"; never executed: return "WalltimeMilliseconds"; | 0 |
| 96 | case Events: executed 240 times by 1 test: case Events:Executed by:
| 240 |
| 97 | return "Events"; executed 240 times by 1 test: return "Events";Executed by:
| 240 |
| 98 | case CPUTicks: never executed: case CPUTicks: | 0 |
| 99 | return "CPUTicks"; never executed: return "CPUTicks"; | 0 |
| 100 | case CPUMigrations: never executed: case CPUMigrations: | 0 |
| 101 | return "CPUMigrations"; never executed: return "CPUMigrations"; | 0 |
| 102 | case CPUCycles: never executed: case CPUCycles: | 0 |
| 103 | return "CPUCycles"; never executed: return "CPUCycles"; | 0 |
| 104 | case BusCycles: never executed: case BusCycles: | 0 |
| 105 | return "BusCycles"; never executed: return "BusCycles"; | 0 |
| 106 | case StalledCycles: never executed: case StalledCycles: | 0 |
| 107 | return "StalledCycles"; never executed: return "StalledCycles"; | 0 |
| 108 | case InstructionReads: never executed: case InstructionReads: | 0 |
| 109 | return "InstructionReads"; never executed: return "InstructionReads"; | 0 |
| 110 | case Instructions: never executed: case Instructions: | 0 |
| 111 | return "Instructions"; never executed: return "Instructions"; | 0 |
| 112 | case WalltimeNanoseconds: never executed: case WalltimeNanoseconds: | 0 |
| 113 | return "WalltimeNanoseconds"; never executed: return "WalltimeNanoseconds"; | 0 |
| 114 | case BytesAllocated: never executed: case BytesAllocated: | 0 |
| 115 | return "BytesAllocated"; never executed: return "BytesAllocated"; | 0 |
| 116 | case BranchInstructions: never executed: case BranchInstructions: | 0 |
| 117 | return "BranchInstructions"; never executed: return "BranchInstructions"; | 0 |
| 118 | case BranchMisses: never executed: case BranchMisses: | 0 |
| 119 | return "BranchMisses"; never executed: return "BranchMisses"; | 0 |
| 120 | case CacheReferences: never executed: case CacheReferences: | 0 |
| 121 | return "CacheReferences"; never executed: return "CacheReferences"; | 0 |
| 122 | case CacheReads: never executed: case CacheReads: | 0 |
| 123 | return "CacheReads"; never executed: return "CacheReads"; | 0 |
| 124 | case CacheWrites: never executed: case CacheWrites: | 0 |
| 125 | return "CacheWrites"; never executed: return "CacheWrites"; | 0 |
| 126 | case CachePrefetches: never executed: case CachePrefetches: | 0 |
| 127 | return "CachePrefetches"; never executed: return "CachePrefetches"; | 0 |
| 128 | case CacheMisses: never executed: case CacheMisses: | 0 |
| 129 | return "CacheMisses"; never executed: return "CacheMisses"; | 0 |
| 130 | case CacheReadMisses: never executed: case CacheReadMisses: | 0 |
| 131 | return "CacheReadMisses"; never executed: return "CacheReadMisses"; | 0 |
| 132 | case CacheWriteMisses: never executed: case CacheWriteMisses: | 0 |
| 133 | return "CacheWriteMisses"; never executed: return "CacheWriteMisses"; | 0 |
| 134 | case CachePrefetchMisses: never executed: case CachePrefetchMisses: | 0 |
| 135 | return "CachePrefetchMisses"; never executed: return "CachePrefetchMisses"; | 0 |
| 136 | case ContextSwitches: never executed: case ContextSwitches: | 0 |
| 137 | return "ContextSwitches"; never executed: return "ContextSwitches"; | 0 |
| 138 | case PageFaults: never executed: case PageFaults: | 0 |
| 139 | return "PageFaults"; never executed: return "PageFaults"; | 0 |
| 140 | case MinorPageFaults: never executed: case MinorPageFaults: | 0 |
| 141 | return "MinorPageFaults"; never executed: return "MinorPageFaults"; | 0 |
| 142 | case MajorPageFaults: never executed: case MajorPageFaults: | 0 |
| 143 | return "MajorPageFaults"; never executed: return "MajorPageFaults"; | 0 |
| 144 | case AlignmentFaults: never executed: case AlignmentFaults: | 0 |
| 145 | return "AlignmentFaults"; never executed: return "AlignmentFaults"; | 0 |
| 146 | case EmulationFaults: never executed: case EmulationFaults: | 0 |
| 147 | return "EmulationFaults"; never executed: return "EmulationFaults"; | 0 |
| 148 | default: never executed: default: | 0 |
| 149 | return ""; never executed: return ""; | 0 |
| 150 | } | - |
| 151 | }; | - |
| 152 | - | |
| 153 | /*! | - |
| 154 | \since 4.7 | - |
| 155 | Retuns the units of measure for the specified \a metric. | - |
| 156 | */ | - |
| 157 | const char * QTest::benchmarkMetricUnit(QBenchmarkMetric metric) | - |
| 158 | { | - |
| 159 | switch (metric) { | - |
| 160 | case FramesPerSecond: never executed: case FramesPerSecond: | 0 |
| 161 | return "fps"; never executed: return "fps"; | 0 |
| 162 | case BitsPerSecond: never executed: case BitsPerSecond: | 0 |
| 163 | return "bits/s"; never executed: return "bits/s"; | 0 |
| 164 | case BytesPerSecond: never executed: case BytesPerSecond: | 0 |
| 165 | return "bytes/s"; never executed: return "bytes/s"; | 0 |
| 166 | case WalltimeMilliseconds: executed 8 times by 1 test: case WalltimeMilliseconds:Executed by:
| 8 |
| 167 | return "msecs"; executed 8 times by 1 test: return "msecs";Executed by:
| 8 |
| 168 | case Events: executed 86 times by 1 test: case Events:Executed by:
| 86 |
| 169 | return "events"; executed 86 times by 1 test: return "events";Executed by:
| 86 |
| 170 | case CPUTicks: never executed: case CPUTicks: | 0 |
| 171 | return "CPU ticks"; never executed: return "CPU ticks"; | 0 |
| 172 | case CPUMigrations: never executed: case CPUMigrations: | 0 |
| 173 | return "CPU migrations"; never executed: return "CPU migrations"; | 0 |
| 174 | case CPUCycles: never executed: case CPUCycles: | 0 |
| 175 | return "CPU cycles"; never executed: return "CPU cycles"; | 0 |
| 176 | case BusCycles: never executed: case BusCycles: | 0 |
| 177 | return "bus cycles"; never executed: return "bus cycles"; | 0 |
| 178 | case StalledCycles: never executed: case StalledCycles: | 0 |
| 179 | return "stalled cycles"; never executed: return "stalled cycles"; | 0 |
| 180 | case InstructionReads: never executed: case InstructionReads: | 0 |
| 181 | return "instruction reads"; never executed: return "instruction reads"; | 0 |
| 182 | case Instructions: never executed: case Instructions: | 0 |
| 183 | return "instructions"; never executed: return "instructions"; | 0 |
| 184 | case WalltimeNanoseconds: never executed: case WalltimeNanoseconds: | 0 |
| 185 | return "nsecs"; never executed: return "nsecs"; | 0 |
| 186 | case BytesAllocated: never executed: case BytesAllocated: | 0 |
| 187 | return "bytes"; never executed: return "bytes"; | 0 |
| 188 | case BranchInstructions: never executed: case BranchInstructions: | 0 |
| 189 | return "branch instructions"; never executed: return "branch instructions"; | 0 |
| 190 | case BranchMisses: never executed: case BranchMisses: | 0 |
| 191 | return "branch misses"; never executed: return "branch misses"; | 0 |
| 192 | case CacheReferences: never executed: case CacheReferences: | 0 |
| 193 | return "cache references"; never executed: return "cache references"; | 0 |
| 194 | case CacheReads: never executed: case CacheReads: | 0 |
| 195 | return "cache loads"; never executed: return "cache loads"; | 0 |
| 196 | case CacheWrites: never executed: case CacheWrites: | 0 |
| 197 | return "cache stores"; never executed: return "cache stores"; | 0 |
| 198 | case CachePrefetches: never executed: case CachePrefetches: | 0 |
| 199 | return "cache prefetches"; never executed: return "cache prefetches"; | 0 |
| 200 | case CacheMisses: never executed: case CacheMisses: | 0 |
| 201 | return "cache misses"; never executed: return "cache misses"; | 0 |
| 202 | case CacheReadMisses: never executed: case CacheReadMisses: | 0 |
| 203 | return "cache load misses"; never executed: return "cache load misses"; | 0 |
| 204 | case CacheWriteMisses: never executed: case CacheWriteMisses: | 0 |
| 205 | return "cache store misses"; never executed: return "cache store misses"; | 0 |
| 206 | case CachePrefetchMisses: never executed: case CachePrefetchMisses: | 0 |
| 207 | return "cache prefetch misses"; never executed: return "cache prefetch misses"; | 0 |
| 208 | case ContextSwitches: never executed: case ContextSwitches: | 0 |
| 209 | return "context switches"; never executed: return "context switches"; | 0 |
| 210 | case PageFaults: never executed: case PageFaults: | 0 |
| 211 | return "page faults"; never executed: return "page faults"; | 0 |
| 212 | case MinorPageFaults: never executed: case MinorPageFaults: | 0 |
| 213 | return "minor page faults"; never executed: return "minor page faults"; | 0 |
| 214 | case MajorPageFaults: never executed: case MajorPageFaults: | 0 |
| 215 | return "major page faults"; never executed: return "major page faults"; | 0 |
| 216 | case AlignmentFaults: never executed: case AlignmentFaults: | 0 |
| 217 | return "alignment faults"; never executed: return "alignment faults"; | 0 |
| 218 | case EmulationFaults: never executed: case EmulationFaults: | 0 |
| 219 | return "emulation faults"; never executed: return "emulation faults"; | 0 |
| 220 | default: never executed: default: | 0 |
| 221 | return ""; never executed: return ""; | 0 |
| 222 | } | - |
| 223 | } | - |
| 224 | - | |
| Source code | Switch to Preprocessed file |