Log which watchdog timer was exceeded

Test: Timeout failure for max_concurrent.framebuffer on Marlin
Change-Id: Ie8396c6506e09bbe94c6d5dc6c29fd6e20c7f436
diff --git a/framework/common/tcuApp.cpp b/framework/common/tcuApp.cpp
index 409a677..7c49f7f 100644
--- a/framework/common/tcuApp.cpp
+++ b/framework/common/tcuApp.cpp
@@ -203,10 +203,10 @@
 	return platformOk && testExecOk;
 }
 
-void App::onWatchdogTimeout (qpWatchDog* watchDog, void* userPtr)
+void App::onWatchdogTimeout (qpWatchDog* watchDog, void* userPtr, qpTimeoutReason reason)
 {
 	DE_UNREF(watchDog);
-	static_cast<App*>(userPtr)->onWatchdogTimeout();
+	static_cast<App*>(userPtr)->onWatchdogTimeout(reason);
 }
 
 void App::onCrash (qpCrashHandler* crashHandler, void* userPtr)
@@ -215,7 +215,7 @@
 	static_cast<App*>(userPtr)->onCrash();
 }
 
-void App::onWatchdogTimeout (void)
+void App::onWatchdogTimeout (qpTimeoutReason reason)
 {
 	if (!m_crashLock.tryLock() || m_crashed)
 		return; // In crash handler already.
@@ -223,7 +223,7 @@
 	m_crashed = true;
 
 	m_testCtx->getLog().terminateCase(QP_TEST_RESULT_TIMEOUT);
-	die("Watchdog timer timeout");
+	die("Watchdog timer timeout for %s", (reason == QP_TIMEOUT_REASON_INTERVAL_LIMIT ? "touch interval" : "total time"));
 }
 
 static void writeCrashToLog (void* userPtr, const char* infoString)
diff --git a/framework/common/tcuApp.hpp b/framework/common/tcuApp.hpp
index 8233eb3..e714160 100644
--- a/framework/common/tcuApp.hpp
+++ b/framework/common/tcuApp.hpp
@@ -69,10 +69,10 @@
 protected:
 	void					cleanup				(void);
 
-	void					onWatchdogTimeout	(void);
+	void					onWatchdogTimeout	(qpTimeoutReason reason);
 	void					onCrash				(void);
 
-	static void				onWatchdogTimeout	(qpWatchDog* watchDog, void* userPtr);
+	static void				onWatchdogTimeout	(qpWatchDog* watchDog, void* userPtr, qpTimeoutReason reason);
 	static void				onCrash				(qpCrashHandler* crashHandler, void* userPtr);
 
 	Platform&				m_platform;
diff --git a/framework/qphelper/qpWatchDog.c b/framework/qphelper/qpWatchDog.c
index 84957b8..c691aa2 100644
--- a/framework/qphelper/qpWatchDog.c
+++ b/framework/qphelper/qpWatchDog.c
@@ -69,11 +69,14 @@
 		deUint64	curTime					= deGetMicroseconds();
 		int			totalSecondsPassed		= (int)((curTime - dog->resetTime) / 1000000ull);
 		int			secondsSinceLastTouch	= (int)((curTime - dog->lastTouchTime) / 1000000ull);
+		deBool		overIntervalLimit		= secondsSinceLastTouch > dog->intervalTimeLimit;
+		deBool		overTotalLimit			= totalSecondsPassed > dog->totalTimeLimit;
 
-		if ((secondsSinceLastTouch > dog->intervalTimeLimit) || (totalSecondsPassed > dog->totalTimeLimit))
+		if (overIntervalLimit || overTotalLimit)
 		{
+		    qpTimeoutReason reason = overTotalLimit ? QP_TIMEOUT_REASON_TOTAL_LIMIT : QP_TIMEOUT_REASON_INTERVAL_LIMIT;
 			DBGPRINT(("watchDogThreadFunc(): call timeout func\n"));
-			dog->timeOutFunc(dog, dog->timeOutUserPtr);
+			dog->timeOutFunc(dog, dog->timeOutUserPtr, reason);
 			break;
 		}
 
diff --git a/framework/qphelper/qpWatchDog.h b/framework/qphelper/qpWatchDog.h
index 6ac8f6a..6247e66 100644
--- a/framework/qphelper/qpWatchDog.h
+++ b/framework/qphelper/qpWatchDog.h
@@ -27,7 +27,15 @@
 
 typedef struct qpWatchDog_s	qpWatchDog;
 
-typedef void		(*qpWatchDogFunc)		(qpWatchDog* dog, void* userPtr);
+typedef enum qpTimeoutReason_e
+{
+	QP_TIMEOUT_REASON_INTERVAL_LIMIT = 0,
+	QP_TIMEOUT_REASON_TOTAL_LIMIT,
+
+	QP_TIMEOUT_REASON_LAST
+} qpTimeoutReason;
+
+typedef void		(*qpWatchDogFunc)		(qpWatchDog* dog, void* userPtr, qpTimeoutReason reason);
 
 DE_BEGIN_EXTERN_C