Bug 1200795, part 1 - Eliminate excessive detail from cycle collector graph memory reporting. r=njn

This commit is contained in:
Andrew McCreight 2015-09-04 09:45:44 -07:00
parent 48a154e45c
commit bd863a70b2

View File

@ -877,16 +877,18 @@ public:
return mPtrToNodeMap.EntryCount();
}
void SizeOfExcludingThis(MallocSizeOf aMallocSizeOf,
size_t* aNodesSize, size_t* aEdgesSize,
size_t* aWeakMapsSize) const
size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
{
*aNodesSize = mNodes.SizeOfExcludingThis(aMallocSizeOf);
*aEdgesSize = mEdges.SizeOfExcludingThis(aMallocSizeOf);
size_t n = 0;
n += mNodes.SizeOfExcludingThis(aMallocSizeOf);
n += mEdges.SizeOfExcludingThis(aMallocSizeOf);
// We don't measure what the WeakMappings point to, because the
// pointers are non-owning.
*aWeakMapsSize = mWeakMaps.ShallowSizeOfExcludingThis(aMallocSizeOf);
n += mWeakMaps.ShallowSizeOfExcludingThis(aMallocSizeOf);
return n;
}
};
@ -1315,9 +1317,7 @@ public:
void SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf,
size_t* aObjectSize,
size_t* aGraphNodesSize,
size_t* aGraphEdgesSize,
size_t* aWeakMapsSize,
size_t* aGraphSize,
size_t* aPurpleBufferSize) const;
JSPurpleBuffer* GetJSPurpleBuffer();
@ -3307,12 +3307,9 @@ NS_IMETHODIMP
nsCycleCollector::CollectReports(nsIHandleReportCallback* aHandleReport,
nsISupports* aData, bool aAnonymize)
{
size_t objectSize, graphNodesSize, graphEdgesSize, weakMapsSize,
purpleBufferSize;
size_t objectSize, graphSize, purpleBufferSize;
SizeOfIncludingThis(CycleCollectorMallocSizeOf,
&objectSize,
&graphNodesSize, &graphEdgesSize,
&weakMapsSize,
&objectSize, &graphSize,
&purpleBufferSize);
#define REPORT(_path, _amount, _desc) \
@ -3333,17 +3330,8 @@ nsCycleCollector::CollectReports(nsIHandleReportCallback* aHandleReport,
REPORT("explicit/cycle-collector/collector-object", objectSize,
"Memory used for the cycle collector object itself.");
REPORT("explicit/cycle-collector/graph-nodes", graphNodesSize,
"Memory used for the nodes of the cycle collector's graph. "
"This should be zero when the collector is idle.");
REPORT("explicit/cycle-collector/graph-edges", graphEdgesSize,
"Memory used for the edges of the cycle collector's graph. "
"This should be zero when the collector is idle.");
REPORT("explicit/cycle-collector/weak-maps", weakMapsSize,
"Memory used for the representation of weak maps in the "
"cycle collector's graph. "
REPORT("explicit/cycle-collector/graph", graphSize,
"Memory used for the cycle collector's graph. "
"This should be zero when the collector is idle.");
REPORT("explicit/cycle-collector/purple-buffer", purpleBufferSize,
@ -3859,15 +3847,12 @@ nsCycleCollector::RemoveObjectFromGraph(void* aObj)
void
nsCycleCollector::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf,
size_t* aObjectSize,
size_t* aGraphNodesSize,
size_t* aGraphEdgesSize,
size_t* aWeakMapsSize,
size_t* aGraphSize,
size_t* aPurpleBufferSize) const
{
*aObjectSize = aMallocSizeOf(this);
mGraph.SizeOfExcludingThis(aMallocSizeOf, aGraphNodesSize, aGraphEdgesSize,
aWeakMapsSize);
*aGraphSize = mGraph.SizeOfExcludingThis(aMallocSizeOf);
*aPurpleBufferSize = mPurpleBuf.SizeOfExcludingThis(aMallocSizeOf);