diff options
author | Milian Wolff <milian.wolff@kdab.com> | 2016-02-16 15:57:15 +0100 |
---|---|---|
committer | Milian Wolff <milian.wolff@kdab.com> | 2016-03-03 09:55:22 +0000 |
commit | fe04aba46df291389e462d9e89387a4e4547b33f (patch) | |
tree | 5cbf9222551bc6887e25f8e63ff570cfce0b83c5 /src/testlib | |
parent | 9c1d3bc253abd4418f3050d19ec5f05bef3ada97 (diff) |
Enable support for ref-cycles perf counter in QtTestLib.
The ref-cycles counter corresponds to the monotonic timestamp counter
that can be read using the RDTSC assembler instruction. Using it
instead of the default cycles counter is useful as it removes the
effect of dynamic frequency scaling on the measurement.
[ChangeLog][QtTest] The ref-cycles perf counter can now be used.
Change-Id: Id7d56576db362706c20f9a399e5acea35ee799f2
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'src/testlib')
-rw-r--r-- | src/testlib/qbenchmarkmetric.cpp | 5 | ||||
-rw-r--r-- | src/testlib/qbenchmarkmetric.h | 3 | ||||
-rw-r--r-- | src/testlib/qbenchmarkperfevents.cpp | 9 |
3 files changed, 13 insertions, 4 deletions
diff --git a/src/testlib/qbenchmarkmetric.cpp b/src/testlib/qbenchmarkmetric.cpp index 0a9072907f..0ba55dbeb7 100644 --- a/src/testlib/qbenchmarkmetric.cpp +++ b/src/testlib/qbenchmarkmetric.cpp @@ -56,6 +56,7 @@ \value CPUTicks CPU time \value CPUMigrations Process migrations between CPUs \value CPUCycles CPU cycles + \value RefCPUCycles Reference CPU cycles \value BusCycles Bus cycles \value StalledCycles Cycles stalled \value InstructionReads Instruction reads @@ -108,6 +109,8 @@ const char * QTest::benchmarkMetricName(QBenchmarkMetric metric) return "CPUMigrations"; case CPUCycles: return "CPUCycles"; + case RefCPUCycles: + return "RefCPUCycles"; case BusCycles: return "BusCycles"; case StalledCycles: @@ -180,6 +183,8 @@ const char * QTest::benchmarkMetricUnit(QBenchmarkMetric metric) return "CPU migrations"; case CPUCycles: return "CPU cycles"; + case RefCPUCycles: + return "Reference CPU cycles"; case BusCycles: return "bus cycles"; case StalledCycles: diff --git a/src/testlib/qbenchmarkmetric.h b/src/testlib/qbenchmarkmetric.h index 44bf14b9b6..6e423473b1 100644 --- a/src/testlib/qbenchmarkmetric.h +++ b/src/testlib/qbenchmarkmetric.h @@ -78,7 +78,8 @@ enum QBenchmarkMetric { MinorPageFaults, MajorPageFaults, AlignmentFaults, - EmulationFaults + EmulationFaults, + RefCPUCycles, }; } diff --git a/src/testlib/qbenchmarkperfevents.cpp b/src/testlib/qbenchmarkperfevents.cpp index 587d3e0124..d6db40ce52 100644 --- a/src/testlib/qbenchmarkperfevents.cpp +++ b/src/testlib/qbenchmarkperfevents.cpp @@ -153,6 +153,7 @@ bool QBenchmarkPerfEventsMeasurer::isAvailable() Event type Event counter Unit Name and aliases HARDWARE CPU_CYCLES CPUCycles cycles cpu-cycles + HARDWARE REF_CPU_CYCLES RefCPUCycles ref-cycles HARDWARE INSTRUCTIONS Instructions instructions HARDWARE CACHE_REFERENCES CacheReferences cache-references HARDWARE CACHE_MISSES CacheMisses cache-misses @@ -321,6 +322,7 @@ static const char eventlist_strings[] = "migrations\0" "minor-faults\0" "page-faults\0" + "ref-cycles\0" "stalled-cycles-backend\0" "stalled-cycles-frontend\0" "task-clock\0" @@ -407,9 +409,10 @@ static const Events eventlist[] = { { 1256, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_CPU_MIGRATIONS, QTest::CPUMigrations }, { 1267, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_PAGE_FAULTS_MIN, QTest::MinorPageFaults }, { 1280, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_PAGE_FAULTS, QTest::PageFaults }, - { 1292, PERF_TYPE_HARDWARE, PERF_COUNT_HW_STALLED_CYCLES_BACKEND, QTest::StalledCycles }, - { 1315, PERF_TYPE_HARDWARE, PERF_COUNT_HW_STALLED_CYCLES_FRONTEND, QTest::StalledCycles }, - { 1339, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_TASK_CLOCK, QTest::WalltimeMilliseconds }, + { 1292, PERF_TYPE_HARDWARE, PERF_COUNT_HW_REF_CPU_CYCLES, QTest::RefCPUCycles }, + { 1303, PERF_TYPE_HARDWARE, PERF_COUNT_HW_STALLED_CYCLES_BACKEND, QTest::StalledCycles }, + { 1326, PERF_TYPE_HARDWARE, PERF_COUNT_HW_STALLED_CYCLES_FRONTEND, QTest::StalledCycles }, + { 1350, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_TASK_CLOCK, QTest::WalltimeMilliseconds }, { 0, PERF_TYPE_MAX, 0, QTest::Events } }; /* -- END GENERATED CODE -- */ |