summaryrefslogtreecommitdiff
path: root/src/testlib
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@nokia.com>2010-05-27 16:07:46 +0200
committerSamuel Rødal <samuel.rodal@nokia.com>2010-05-28 12:27:57 +0200
commitfa7dfb24c2d165cad438eb28c83ac2fd60831b29 (patch)
tree36f402951d61d71b325ce9c710930cf9d28a2b68 /src/testlib
parent49a5cf7cd44584e04d1f54f3fbd0d5c86fe55c83 (diff)
downloadqt4-tools-fa7dfb24c2d165cad438eb28c83ac2fd60831b29.tar.gz
Improve precision of testlib benchmarking.
20 ms is a bit too to get a precise measurement due to limited timer resolution. We increase the limit to 50 ms and introduce a warm-up iteration to prevent any state or cache-related issues which can be hard to account for in the tests. On the N900 this seems to decrease the variance of test results by 30 %, and fixes some cases where the results were way off due to hidden state. Task-number: QT-3390 Reviewed-by: Morten Sørvig
Diffstat (limited to 'src/testlib')
-rw-r--r--src/testlib/qbenchmarkmeasurement.cpp7
-rw-r--r--src/testlib/qbenchmarkmeasurement_p.h1
2 files changed, 7 insertions, 1 deletions
diff --git a/src/testlib/qbenchmarkmeasurement.cpp b/src/testlib/qbenchmarkmeasurement.cpp
index c03cbff2ac..0a84792d7e 100644
--- a/src/testlib/qbenchmarkmeasurement.cpp
+++ b/src/testlib/qbenchmarkmeasurement.cpp
@@ -66,7 +66,7 @@ qint64 QBenchmarkTimeMeasurer::stop()
bool QBenchmarkTimeMeasurer::isMeasurementAccepted(qint64 measurement)
{
- return (measurement > 20);
+ return (measurement > 50);
}
int QBenchmarkTimeMeasurer::adjustIterationCount(int suggestion)
@@ -74,6 +74,11 @@ int QBenchmarkTimeMeasurer::adjustIterationCount(int suggestion)
return suggestion;
}
+bool QBenchmarkTimeMeasurer::needsWarmupIteration()
+{
+ return true;
+}
+
int QBenchmarkTimeMeasurer::adjustMedianCount(int)
{
return 1;
diff --git a/src/testlib/qbenchmarkmeasurement_p.h b/src/testlib/qbenchmarkmeasurement_p.h
index 8ad36134c7..932852c090 100644
--- a/src/testlib/qbenchmarkmeasurement_p.h
+++ b/src/testlib/qbenchmarkmeasurement_p.h
@@ -84,6 +84,7 @@ public:
bool isMeasurementAccepted(qint64 measurement);
int adjustIterationCount(int sugestion);
int adjustMedianCount(int suggestion);
+ bool needsWarmupIteration();
QTest::QBenchmarkMetric metricType();
private:
QTime time;