summaryrefslogtreecommitdiffstats
path: root/src/testlib
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2022-10-21 13:51:39 -0700
committerThiago Macieira <thiago.macieira@intel.com>2022-10-25 11:14:35 -0700
commitfeb6463772471a91e3ec9787f99a8e0221fe18ae (patch)
tree7f42596c8ef24428b50b57bf2435a87632101154 /src/testlib
parent10d5c0adafb7989c44794caef14a192cce9673a7 (diff)
QBenchlib: force the warmup to run a single iteration
The purpose of warming up is to get all code paths executed, so any lazy function resolving is processed, statics are allocated, etc. There's no reason to run it more than once -- if you're trying to train the Branch Predictor Unit, you'd want to do it another way anyway. This is useful when benchmarking with -iterations N, because QBenchlib currently runs 2*N iterations because of the warm up. That just wastes time. Change-Id: I3c79b7e08fa346988dfefffd172030c889b31a1f Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/testlib')
-rw-r--r--src/testlib/qtestcase.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp
index cd8b6edeb7..347008fe02 100644
--- a/src/testlib/qtestcase.cpp
+++ b/src/testlib/qtestcase.cpp
@@ -1117,6 +1117,8 @@ void TestMethods::invokeTestOnData(int index) const
bool minimumTotalReached = false;
do {
QBenchmarkTestMethodData::current->beginDataRun();
+ if (i < 0)
+ QBenchmarkTestMethodData::current->iterationCount = 1;
/* Benchmarking: for each accumulation iteration*/
bool invokeOk;