QBenchlib/Perf: use WalltimeNanoseconds for the task time
Avoids the special case in the code and removes the need to run a large number of iterations to get any useful result, plus makes it's more readable: From: 0.00002125 msecs per iteration (total: 2,125, iterations: 100000000) To: 22.082 nsecs per iteration (total: 22,082, iterations: 1000) Pick-to: 6.4 Change-Id: I3c79b7e08fa346988dfefffd171facc98af9e9fc Reviewed-by: David Faure <david.faure@kdab.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
parent
483ae6c448
commit
e693a5ccaf
@ -128,8 +128,8 @@ bool QBenchmarkPerfEventsMeasurer::isAvailable()
|
||||
HARDWARE BUS_CYCLES BusCycles bus-cycles
|
||||
HARDWARE STALLED_CYCLES_FRONTEND StalledCycles stalled-cycles-frontend idle-cycles-frontend
|
||||
HARDWARE STALLED_CYCLES_BACKEND StalledCycles stalled-cycles-backend idle-cycles-backend
|
||||
SOFTWARE CPU_CLOCK WalltimeMilliseconds cpu-clock
|
||||
SOFTWARE TASK_CLOCK WalltimeMilliseconds task-clock
|
||||
SOFTWARE CPU_CLOCK WalltimeNanoseconds cpu-clock
|
||||
SOFTWARE TASK_CLOCK WalltimeNanoseconds task-clock
|
||||
SOFTWARE PAGE_FAULTS PageFaults page-faults faults
|
||||
SOFTWARE PAGE_FAULTS_MAJ MajorPageFaults major-faults
|
||||
SOFTWARE PAGE_FAULTS_MIN MinorPageFaults minor-faults
|
||||
@ -309,7 +309,7 @@ static const Events eventlist[] = {
|
||||
{ 170, PERF_TYPE_HARDWARE, PERF_COUNT_HW_CACHE_MISSES, QTest::CacheMisses },
|
||||
{ 183, PERF_TYPE_HARDWARE, PERF_COUNT_HW_CACHE_REFERENCES, QTest::CacheReferences },
|
||||
{ 200, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_CONTEXT_SWITCHES, QTest::ContextSwitches },
|
||||
{ 217, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_CPU_CLOCK, QTest::WalltimeMilliseconds },
|
||||
{ 217, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_CPU_CLOCK, QTest::WalltimeNanoseconds },
|
||||
{ 227, PERF_TYPE_HARDWARE, PERF_COUNT_HW_CPU_CYCLES, QTest::CPUCycles },
|
||||
{ 238, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_CPU_MIGRATIONS, QTest::CPUMigrations },
|
||||
{ 253, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_CONTEXT_SWITCHES, QTest::ContextSwitches },
|
||||
@ -378,7 +378,7 @@ static const Events eventlist[] = {
|
||||
{ 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 },
|
||||
{ 1350, PERF_TYPE_SOFTWARE, PERF_COUNT_SW_TASK_CLOCK, QTest::WalltimeNanoseconds },
|
||||
{ 0, PERF_TYPE_MAX, 0, QTest::Events }
|
||||
};
|
||||
/* -- END GENERATED CODE -- */
|
||||
@ -570,10 +570,6 @@ static quint64 rawReadValue(int fd)
|
||||
qint64 QBenchmarkPerfEventsMeasurer::readValue()
|
||||
{
|
||||
quint64 raw = rawReadValue(fd);
|
||||
if (metricType() == QTest::WalltimeMilliseconds) {
|
||||
// perf returns nanoseconds
|
||||
return raw / 1000000;
|
||||
}
|
||||
return raw;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user