From 93fe3895cfad75f095b8b1d48cce48ba17600b4e Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 9 Apr 2012 15:20:15 -0300 Subject: Add more events for QBenchlib, based on the Linux perf counters Change-Id: Ic7e7e122bfe3995eb7ea033c744fd501579ea8fa Reviewed-by: Jason McDonald --- src/testlib/qbenchmarkmetric.cpp | 124 ++++++++++++++++++++++++++++++++--- src/testlib/qbenchmarkmetric.h | 23 ++++++- src/testlib/qbenchmarkperfevents.cpp | 2 +- 3 files changed, 137 insertions(+), 12 deletions(-) (limited to 'src/testlib') diff --git a/src/testlib/qbenchmarkmetric.cpp b/src/testlib/qbenchmarkmetric.cpp index ca802e3688..727b9fb912 100644 --- a/src/testlib/qbenchmarkmetric.cpp +++ b/src/testlib/qbenchmarkmetric.cpp @@ -51,19 +51,39 @@ \value BitsPerSecond Bits per second \value BytesPerSecond Bytes per second \value WalltimeMilliseconds Clock time in milliseconds - \value CPUTicks CPU time - \value InstructionReads Instruction reads - \value Events Event count \value WalltimeNanoseconds Clock time in nanoseconds \value BytesAllocated Memory usage in bytes + \value Events Event count + \value CPUTicks CPU time + \value CPUMigrations Process migrations between CPUs + \value CPUCycles CPU cycles + \value BusCycles Bus cycles + \value StalledCycles Cycles stalled + \value InstructionReads Instruction reads + \value Instructions Instructions executed + \value BranchInstructions Branch-type instructions + \value BranchMisses Branch instructions that were mispredicted + \value CacheReferences Cache accesses of any type + \value CacheMisses Cache misses of any type + \value CacheReads Cache reads / loads + \value CacheReadMisses Cache read / load misses + \value CacheWrites Cache writes / stores + \value CacheWriteMisses Cache write / store misses + \value CachePrefetches Cache prefetches + \value CachePrefetchMisses Cache prefetch misses + \value ContextSwitches Context switches + \value PageFaults Page faults of any type + \value MinorPageFaults Minor page faults + \value MajorPageFaults Major page faults + \value AlignmentFaults Faults caused due to misalignment + \value EmulationFaults Faults that needed software emulation + + \sa QTest::benchmarkMetricName(), QTest::benchmarkMetricUnit() Note that \c WalltimeNanoseconds and \c BytesAllocated are only provided for use via \l setBenchmarkResult(), and results in those metrics are not able to be provided automatically by the QTest framework. - - \sa QTest::benchmarkMetricName(), QTest::benchmarkMetricUnit() - */ /*! @@ -82,16 +102,58 @@ const char * QTest::benchmarkMetricName(QBenchmarkMetric metric) return "BytesPerSecond"; case WalltimeMilliseconds: return "WalltimeMilliseconds"; + case Events: + return "Events"; case CPUTicks: return "CPUTicks"; + case CPUMigrations: + return "CPUMigrations"; + case CPUCycles: + return "CPUCycles"; + case BusCycles: + return "BusCycles"; + case StalledCycles: + return "StalledCycles"; case InstructionReads: return "InstructionReads"; - case Events: - return "Events"; + case Instructions: + return "Instructions"; case WalltimeNanoseconds: return "WalltimeNanoseconds"; case BytesAllocated: return "BytesAllocated"; + case BranchInstructions: + return "BranchInstructions"; + case BranchMisses: + return "BranchMisses"; + case CacheReferences: + return "CacheReferences"; + case CacheReads: + return "CacheReads"; + case CacheWrites: + return "CacheWrites"; + case CachePrefetches: + return "CachePrefetches"; + case CacheMisses: + return "CacheMisses"; + case CacheReadMisses: + return "CacheReadMisses"; + case CacheWriteMisses: + return "CacheWriteMisses"; + case CachePrefetchMisses: + return "CachePrefetchMisses"; + case ContextSwitches: + return "ContextSwitches"; + case PageFaults: + return "PageFaults"; + case MinorPageFaults: + return "MinorPageFaults"; + case MajorPageFaults: + return "MajorPageFaults"; + case AlignmentFaults: + return "AlignmentFaults"; + case EmulationFaults: + return "EmulationFaults"; default: return ""; } @@ -113,16 +175,58 @@ const char * QTest::benchmarkMetricUnit(QBenchmarkMetric metric) return "bytes/s"; case WalltimeMilliseconds: return "msecs"; + case Events: + return "events"; case CPUTicks: return "CPU ticks"; + case CPUMigrations: + return "CPU migrations"; + case CPUCycles: + return "CPU cycles"; + case BusCycles: + return "bus cycles"; + case StalledCycles: + return "stalled cycles"; case InstructionReads: return "instruction reads"; - case Events: - return "events"; + case Instructions: + return "instructions"; case WalltimeNanoseconds: return "nsecs"; case BytesAllocated: return "bytes"; + case BranchInstructions: + return "branch instructions"; + case BranchMisses: + return "branch misses"; + case CacheReferences: + return "cache references"; + case CacheReads: + return "cache loads"; + case CacheWrites: + return "cache stores"; + case CachePrefetches: + return "cache prefetches"; + case CacheMisses: + return "cache misses"; + case CacheReadMisses: + return "cache load misses"; + case CacheWriteMisses: + return "cache store misses"; + case CachePrefetchMisses: + return "cache prefetch misses"; + case ContextSwitches: + return "context switches"; + case PageFaults: + return "page faults"; + case MinorPageFaults: + return "minor page faults"; + case MajorPageFaults: + return "major page faults"; + case AlignmentFaults: + return "alignment faults"; + case EmulationFaults: + return "emulation faults"; default: return ""; } diff --git a/src/testlib/qbenchmarkmetric.h b/src/testlib/qbenchmarkmetric.h index 3de73f6f87..448df3f691 100644 --- a/src/testlib/qbenchmarkmetric.h +++ b/src/testlib/qbenchmarkmetric.h @@ -58,7 +58,28 @@ enum QBenchmarkMetric { InstructionReads, Events, WalltimeNanoseconds, - BytesAllocated + BytesAllocated, + CPUMigrations, + CPUCycles, + BusCycles, + StalledCycles, + Instructions, + BranchInstructions, + BranchMisses, + CacheReferences, + CacheReads, + CacheWrites, + CachePrefetches, + CacheMisses, + CacheReadMisses, + CacheWriteMisses, + CachePrefetchMisses, + ContextSwitches, + PageFaults, + MinorPageFaults, + MajorPageFaults, + AlignmentFaults, + EmulationFaults }; } diff --git a/src/testlib/qbenchmarkperfevents.cpp b/src/testlib/qbenchmarkperfevents.cpp index 178d4cc7e8..5ed76f9aa7 100644 --- a/src/testlib/qbenchmarkperfevents.cpp +++ b/src/testlib/qbenchmarkperfevents.cpp @@ -175,7 +175,7 @@ int QBenchmarkPerfEventsMeasurer::adjustMedianCount(int) QTest::QBenchmarkMetric QBenchmarkPerfEventsMeasurer::metricType() { - return QTest::Events; + return QTest::CPUCycles; } qint64 QBenchmarkPerfEventsMeasurer::readValue() -- cgit v1.2.3