diff options
author | Jason Barron <jbarron@trolltech.com> | 2009-08-10 11:47:28 (GMT) |
---|---|---|
committer | Jason Barron <jbarron@trolltech.com> | 2009-08-10 11:47:28 (GMT) |
commit | 0df5d5e4367a8052082897d02b4f00429d5cc4c1 (patch) | |
tree | cc8a59f0e37dbd618270bbca5b644fc3b775d60a /src/testlib/qbenchmark.cpp | |
parent | f61ec84fc296c6f70011e30788ee511d6b6a18c6 (diff) | |
parent | 17bffacda99055831bb4c8c6e7da39ec15415519 (diff) | |
download | Qt-0df5d5e4367a8052082897d02b4f00429d5cc4c1.zip Qt-0df5d5e4367a8052082897d02b4f00429d5cc4c1.tar.gz Qt-0df5d5e4367a8052082897d02b4f00429d5cc4c1.tar.bz2 |
Merge commit 'qt/master'
Diffstat (limited to 'src/testlib/qbenchmark.cpp')
-rw-r--r-- | src/testlib/qbenchmark.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/testlib/qbenchmark.cpp b/src/testlib/qbenchmark.cpp index 35ff376..fa17461 100644 --- a/src/testlib/qbenchmark.cpp +++ b/src/testlib/qbenchmark.cpp @@ -116,7 +116,7 @@ int QBenchmarkGlobalData::adjustMedianIterationCount() QBenchmarkTestMethodData *QBenchmarkTestMethodData::current; QBenchmarkTestMethodData::QBenchmarkTestMethodData() -:resultAccepted(false), iterationCount(-1) +:resultAccepted(false), runOnce(false), iterationCount(-1) { } @@ -157,6 +157,11 @@ void QBenchmarkTestMethodData::setResult(qint64 value) if (QBenchmarkGlobalData::current->iterationCount != -1) accepted = true; + if (QBenchmarkTestMethodData::current->runOnce) { + iterationCount = 1; + accepted = true; + } + // Test the result directly without calling the measurer if the minimum time // has been specifed on the command line with -minimumvalue. else if (QBenchmarkGlobalData::current->walltimeMinimum != -1) @@ -179,10 +184,12 @@ void QBenchmarkTestMethodData::setResult(qint64 value) drive the benchmarking loop. It is repsonsible for starting and stopping the timing measurements as well as calling the result reporting functions. */ -QTest::QBenchmarkIterationController::QBenchmarkIterationController() +QTest::QBenchmarkIterationController::QBenchmarkIterationController(RunMode runMode) { QTest::beginBenchmarkMeasurement(); i = 0; + if (runMode == RunOnce) + QBenchmarkTestMethodData::current->runOnce = true; } /*! \internal */ @@ -195,6 +202,8 @@ QTest::QBenchmarkIterationController::~QBenchmarkIterationController() */ bool QTest::QBenchmarkIterationController::isDone() { + if (QBenchmarkTestMethodData::current->runOnce) + return i > 0; return i >= QTest::iterationCount(); } |