From feb6463772471a91e3ec9787f99a8e0221fe18ae Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 21 Oct 2022 13:51:39 -0700 Subject: 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 --- src/testlib/qtestcase.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/testlib') 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; -- cgit v1.2.3