bug 585196: Cycle-collector telemetry probe r=bent

This commit is contained in:
Taras Glek 2011-05-12 11:22:25 -07:00
Родитель be1e9274fe
Коммит 084b46b0d0
1 изменённых файлов: 10 добавлений и 5 удалений

Просмотреть файл

@ -125,6 +125,7 @@
#endif
#endif
#include "base/basictypes.h"
#include "nsCycleCollectionParticipant.h"
#include "nsCycleCollectorUtils.h"
#include "nsIProgrammingLanguage.h"
@ -151,7 +152,8 @@
#include "nsIXPConnect.h"
#include "nsIJSRuntimeService.h"
#include "xpcpublic.h"
#include "base/histogram.h"
#include "base/logging.h"
#include <stdio.h>
#include <string.h>
#ifdef WIN32
@ -981,7 +983,7 @@ struct nsCycleCollector
PRBool mFollowupCollection;
PRUint32 mCollectedObjects;
PRBool mFirstCollection;
PRTime mCollectionStart;
TimeStamp mCollectionStart;
nsCycleCollectionLanguageRuntime *mRuntimes[nsIProgrammingLanguage::MAX+1];
nsCycleCollectionXPCOMRuntime mXPCOMRuntime;
@ -2477,8 +2479,8 @@ nsCycleCollector::PrepareForCollection(nsTPtrArray<PtrInfo> *aWhiteNodes)
#ifdef COLLECT_TIME_DEBUG
printf("cc: nsCycleCollector::PrepareForCollection()\n");
mCollectionStart = PR_Now();
#endif
mCollectionStart = TimeStamp::Now();
mCollectionInProgress = PR_TRUE;
@ -2508,10 +2510,13 @@ nsCycleCollector::CleanupAfterCollection()
_heapmin();
#endif
PRUint32 interval((TimeStamp::Now() - mCollectionStart).ToMilliseconds());
#ifdef COLLECT_TIME_DEBUG
printf("cc: CleanupAfterCollection(), total time %lldms\n",
(PR_Now() - mCollectionStart) / PR_USEC_PER_MSEC);
printf("cc: CleanupAfterCollection(), total time %ums\n", interval);
#endif
UMA_HISTOGRAM_TIMES("nsCycleCollector::Collect (ms)",
base::TimeDelta::FromMilliseconds(interval));
#ifdef DEBUG_CC
ExplainLiveExpectedGarbage();
#endif