summaryrefslogtreecommitdiff
path: root/src/VBox/Main/src-server/Performance.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/VBox/Main/src-server/Performance.cpp')
-rw-r--r--src/VBox/Main/src-server/Performance.cpp33
1 files changed, 29 insertions, 4 deletions
diff --git a/src/VBox/Main/src-server/Performance.cpp b/src/VBox/Main/src-server/Performance.cpp
index 6726e14da..315c46f71 100644
--- a/src/VBox/Main/src-server/Performance.cpp
+++ b/src/VBox/Main/src-server/Performance.cpp
@@ -162,6 +162,9 @@ int CGRQEnable::execute()
void CGRQEnable::debugPrint(void *aObject, const char *aFunction, const char *aText)
{
+ NOREF(aObject);
+ NOREF(aFunction);
+ NOREF(aText);
LogAleksey(("{%p} " LOG_FN_FMT ": CGRQEnable(mask=0x%x) %s\n",
aObject, aFunction, mMask, aText));
}
@@ -174,6 +177,9 @@ int CGRQDisable::execute()
void CGRQDisable::debugPrint(void *aObject, const char *aFunction, const char *aText)
{
+ NOREF(aObject);
+ NOREF(aFunction);
+ NOREF(aText);
LogAleksey(("{%p} " LOG_FN_FMT ": CGRQDisable(mask=0x%x) %s\n",
aObject, aFunction, mMask, aText));
}
@@ -185,6 +191,9 @@ int CGRQAbort::execute()
void CGRQAbort::debugPrint(void *aObject, const char *aFunction, const char *aText)
{
+ NOREF(aObject);
+ NOREF(aFunction);
+ NOREF(aText);
LogAleksey(("{%p} " LOG_FN_FMT ": CGRQAbort %s\n",
aObject, aFunction, aText));
}
@@ -362,6 +371,7 @@ CollectorGuestManager::CollectorGuestManager()
int rc = RTThreadCreate(&mThread, CollectorGuestManager::requestProcessingThread,
this, 0, RTTHREADTYPE_MAIN_WORKER, RTTHREADFLAGS_WAITABLE,
"CGMgr");
+ NOREF(rc);
LogAleksey(("{%p} " LOG_FN_FMT ": RTThreadCreate returned %u (mThread=%p)\n",
this, __PRETTY_FUNCTION__, rc));
}
@@ -479,12 +489,27 @@ int CollectorGuestManager::enqueueRequest(CollectorGuestRequest *aRequest)
* It is very unlikely that we will get high frequency calls to configure
* guest metrics collection, so we rely on this fact to detect blocked
* guests. If the guest has not finished processing the previous request
- * we consider it blocked.
+ * after half a second we consider it blocked.
*/
if (aRequest->getGuest() && aRequest->getGuest() == mGuestBeingCalled)
{
- /* Request execution got stalled for this guest -- report an error */
- return E_FAIL;
+ /*
+ * Before we can declare a guest blocked we need to wait for a while
+ * and then check again as it may never had a chance to process
+ * the previous request. Half a second is an eternity for processes
+ * and is barely noticable by humans.
+ */
+ LogAleksey(("{%p} " LOG_FN_FMT ": Suspecting %s is stalled. Waiting for .5 sec...\n",
+ this, __PRETTY_FUNCTION__,
+ aRequest->getGuest()->getVMName().c_str()));
+ RTThreadSleep(500 /* ms */);
+ if (aRequest->getGuest() == mGuestBeingCalled) {
+ LogAleksey(("{%p} " LOG_FN_FMT ": Request processing stalled for %s\n",
+ this, __PRETTY_FUNCTION__,
+ aRequest->getGuest()->getVMName().c_str()));
+ /* Request execution got stalled for this guest -- report an error */
+ return E_FAIL;
+ }
}
mQueue.push(aRequest);
return S_OK;
@@ -498,7 +523,7 @@ DECLCALLBACK(int) CollectorGuestManager::requestProcessingThread(RTTHREAD /* aTh
HRESULT rc = S_OK;
- LogAleksey(("{%p} " LOG_FN_FMT ": Starting request processing loop...p\n",
+ LogAleksey(("{%p} " LOG_FN_FMT ": Starting request processing loop...\n",
mgr, __PRETTY_FUNCTION__));
while ((pReq = mgr->mQueue.pop()) != NULL)
{