diff --git a/xpcom/base/nsCycleCollector.cpp b/xpcom/base/nsCycleCollector.cpp index ea1529c3446..4700bb6ae39 100644 --- a/xpcom/base/nsCycleCollector.cpp +++ b/xpcom/base/nsCycleCollector.cpp @@ -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 #include #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 *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