summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@theqtcompany.com>2016-05-04 15:21:17 +0200
committerSimon Hausmann <simon.hausmann@qt.io>2016-08-05 14:25:58 +0000
commit4e6440acf8e09abbb2b2aa208f0241416154e090 (patch)
tree560445d37de4780433689118c2b0c836feffaeee
parentceabcc01425664651df08bfa9f148e541287f753 (diff)
Improve reliability of callgrind benchmark results
When running under callgrind, do not bother with the use of the watchdog. The constructor waits for the thread to start, which adds an overall run-time cost that depends on the OS scheduling. Change-Id: I162e2e311c43a6892ebc67dea39899e40babb61d Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
-rw-r--r--src/testlib/qtestcase.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp
index d674b0af7a..fe680e19aa 100644
--- a/src/testlib/qtestcase.cpp
+++ b/src/testlib/qtestcase.cpp
@@ -2548,8 +2548,13 @@ static void qInvokeTestMethods(QObject *testObject)
invokeMethod(testObject, "initTestCase_data()");
QScopedPointer<WatchDog> watchDog;
- if (!debuggerPresent())
+ if (!debuggerPresent()
+#ifdef QTESTLIB_USE_VALGRIND
+ && QBenchmarkGlobalData::current->mode() != QBenchmarkGlobalData::CallgrindChildProcess
+#endif
+ ) {
watchDog.reset(new WatchDog);
+ }
if (!QTestResult::skipCurrentTest() && !QTest::currentTestFailed()) {
invokeMethod(testObject, "initTestCase()");