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>
This commit is contained in:
Simon Hausmann 2016-05-04 15:21:17 +02:00 committed by Simon Hausmann
parent ceabcc0142
commit 4e6440acf8

View File

@ -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()");