summaryrefslogtreecommitdiffstats
path: root/src/testlib
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@nokia.com>2010-05-27 14:07:46 (GMT)
committerSamuel Rødal <samuel.rodal@nokia.com>2010-05-28 10:27:57 (GMT)
commitfa7dfb24c2d165cad438eb28c83ac2fd60831b29 (patch)
tree36f402951d61d71b325ce9c710930cf9d28a2b68 /src/testlib
parent49a5cf7cd44584e04d1f54f3fbd0d5c86fe55c83 (diff)
downloadQt-fa7dfb24c2d165cad438eb28c83ac2fd60831b29.zip
Qt-fa7dfb24c2d165cad438eb28c83ac2fd60831b29.tar.gz
Qt-fa7dfb24c2d165cad438eb28c83ac2fd60831b29.tar.bz2
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 c03cbff..0a84792 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 8ad3613..932852c 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;