Bug 663920 - add telemetry for num of RCed and GCed nodes, and num collected. r=bent

This commit is contained in:
Andrew McCreight 2011-06-10 13:33:06 -07:00
parent c7f5ede852
commit 2a9ee7ba0c
2 changed files with 16 additions and 0 deletions

View File

@ -45,6 +45,9 @@
*/
HISTOGRAM(CYCLE_COLLECTOR, 1, 10000, 50, EXPONENTIAL, "Time spent on one cycle collection (ms)")
HISTOGRAM(CYCLE_COLLECTOR_VISITED_REF_COUNTED, 1, 300000, 50, EXPONENTIAL, "Number of ref counted objects visited by the cycle collector")
HISTOGRAM(CYCLE_COLLECTOR_VISITED_GCED, 1, 300000, 50, EXPONENTIAL, "Number of JS objects visited by the cycle collector")
HISTOGRAM(CYCLE_COLLECTOR_COLLECTED, 1, 100000, 50, EXPONENTIAL, "Number of objects collected by the cycle collector")
HISTOGRAM(TELEMETRY_PING, 1, 3000, 10, EXPONENTIAL, "Time taken to submit telemetry info (ms)")
HISTOGRAM(TELEMETRY_SUCCESS, 0, 1, 2, BOOLEAN, "Successful telemetry submission")
HISTOGRAM(MEMORY_JS_GC_HEAP, 1024, 512 * 1024, 10, EXPONENTIAL, "Memory used by the garbage-collected JavaScript heap (KB)")

View File

@ -1019,6 +1019,10 @@ struct nsCycleCollector
nsTPtrArray<PtrInfo> *mWhiteNodes;
PRUint32 mWhiteNodeCount;
// mVisitedRefCounted and mVisitedGCed are only used for telemetry
PRUint32 mVisitedRefCounted;
PRUint32 mVisitedGCed;
nsPurpleBuffer mPurpleBuf;
void RegisterRuntime(PRUint32 langID,
@ -1623,6 +1627,7 @@ GCGraphBuilder::DescribeRefCountedNode(nsrefcnt refCount, size_t objSz,
Fault("zero refcount", mCurrPi);
if (refCount == PR_UINT32_MAX)
Fault("overflowing refcount", mCurrPi);
sCollector->mVisitedRefCounted++;
DescribeNode(refCount, objSz, objName);
}
@ -1631,6 +1636,7 @@ GCGraphBuilder::DescribeGCedNode(PRBool isMarked, size_t objSz,
const char *objName)
{
PRUint32 refCount = isMarked ? PR_UINT32_MAX : 0;
sCollector->mVisitedGCed++;
DescribeNode(refCount, objSz, objName);
}
@ -2195,6 +2201,8 @@ nsCycleCollector::nsCycleCollector() :
mCollectedObjects(0),
mWhiteNodes(nsnull),
mWhiteNodeCount(0),
mVisitedRefCounted(0),
mVisitedGCed(0),
#ifdef DEBUG_CC
mPurpleBuf(mParams, mStats),
mPtrLog(nsnull)
@ -2568,6 +2576,8 @@ nsCycleCollector::PrepareForCollection(nsTPtrArray<PtrInfo> *aWhiteNodes)
printf("cc: nsCycleCollector::PrepareForCollection()\n");
#endif
mCollectionStart = TimeStamp::Now();
mVisitedRefCounted = 0;
mVisitedGCed = 0;
mCollectionInProgress = PR_TRUE;
@ -2602,6 +2612,9 @@ nsCycleCollector::CleanupAfterCollection()
printf("cc: CleanupAfterCollection(), total time %ums\n", interval);
#endif
Telemetry::Accumulate(Telemetry::CYCLE_COLLECTOR, interval);
Telemetry::Accumulate(Telemetry::CYCLE_COLLECTOR_VISITED_REF_COUNTED, mVisitedRefCounted);
Telemetry::Accumulate(Telemetry::CYCLE_COLLECTOR_VISITED_GCED, mVisitedGCed);
Telemetry::Accumulate(Telemetry::CYCLE_COLLECTOR_COLLECTED, mWhiteNodeCount);
#ifdef DEBUG_CC
ExplainLiveExpectedGarbage();