diff --git a/js/public/MemoryMetrics.h b/js/public/MemoryMetrics.h index 7f1f3397056..f2f0580c67b 100644 --- a/js/public/MemoryMetrics.h +++ b/js/public/MemoryMetrics.h @@ -80,7 +80,7 @@ struct CompartmentStats void *extra; size_t gcHeapArenaAdmin; - size_t gcHeapArenaUnused; + size_t gcHeapUnusedGcThings; size_t gcHeapObjectsNonFunction; size_t gcHeapObjectsFunction; @@ -116,11 +116,11 @@ struct RuntimeStats , gcHeapChunkTotal(0) , gcHeapCommitted(0) , gcHeapUnused(0) - , gcHeapChunkCleanUnused(0) - , gcHeapChunkDirtyUnused(0) + , gcHeapUnusedChunks(0) + , gcHeapUnusedArenas(0) , gcHeapChunkCleanDecommitted(0) , gcHeapChunkDirtyDecommitted(0) - , gcHeapArenaUnused(0) + , gcHeapUnusedGcThings(0) , gcHeapChunkAdmin(0) , totalObjects(0) , totalShapes(0) @@ -139,11 +139,11 @@ struct RuntimeStats size_t gcHeapChunkTotal; size_t gcHeapCommitted; size_t gcHeapUnused; - size_t gcHeapChunkCleanUnused; - size_t gcHeapChunkDirtyUnused; + size_t gcHeapUnusedChunks; + size_t gcHeapUnusedArenas; size_t gcHeapChunkCleanDecommitted; size_t gcHeapChunkDirtyDecommitted; - size_t gcHeapArenaUnused; + size_t gcHeapUnusedGcThings; size_t gcHeapChunkAdmin; size_t totalObjects; size_t totalShapes; diff --git a/js/src/MemoryMetrics.cpp b/js/src/MemoryMetrics.cpp index cf5ccf2ea39..30bf4748196 100644 --- a/js/src/MemoryMetrics.cpp +++ b/js/src/MemoryMetrics.cpp @@ -68,7 +68,7 @@ StatsArenaCallback(JSRuntime *rt, void *data, gc::Arena *arena, // unused space like this: arenaUnused = maxArenaUnused - arenaUsed. // We do this by setting arenaUnused to maxArenaUnused here, and then // subtracting thingSize for every used cell, in StatsCellCallback(). - rtStats->currCompartmentStats->gcHeapArenaUnused += allocationSpace; + rtStats->currCompartmentStats->gcHeapUnusedGcThings += allocationSpace; } static void @@ -148,7 +148,7 @@ StatsCellCallback(JSRuntime *rt, void *data, void *thing, JSGCTraceKind traceKin #endif } // Yes, this is a subtraction: see StatsArenaCallback() for details. - cStats->gcHeapArenaUnused -= thingSize; + cStats->gcHeapUnusedGcThings -= thingSize; } JS_PUBLIC_API(bool) @@ -159,7 +159,7 @@ CollectRuntimeStats(JSRuntime *rt, RuntimeStats *rtStats) rtStats->gcHeapChunkCleanDecommitted = rt->gcChunkPool.countCleanDecommittedArenas(rt) * gc::ArenaSize; - rtStats->gcHeapChunkCleanUnused = + rtStats->gcHeapUnusedChunks = size_t(JS_GetGCParameter(rt, JSGC_UNUSED_CHUNKS)) * gc::ChunkSize - rtStats->gcHeapChunkCleanDecommitted; rtStats->gcHeapChunkTotal = @@ -173,10 +173,10 @@ CollectRuntimeStats(JSRuntime *rt, RuntimeStats *rtStats) // This is initialized to all bytes stored in used chunks, and then we // subtract used space from it each time around the loop. - rtStats->gcHeapChunkDirtyUnused = rtStats->gcHeapChunkTotal - - rtStats->gcHeapChunkCleanUnused - - rtStats->gcHeapChunkCleanDecommitted - - rtStats->gcHeapChunkDirtyDecommitted; + rtStats->gcHeapUnusedArenas = rtStats->gcHeapChunkTotal - + rtStats->gcHeapUnusedChunks - + rtStats->gcHeapChunkCleanDecommitted - + rtStats->gcHeapChunkDirtyDecommitted; rtStats->totalMjit = rtStats->runtime.mjitCode; @@ -186,7 +186,7 @@ CollectRuntimeStats(JSRuntime *rt, RuntimeStats *rtStats) CompartmentStats &cStats = rtStats->compartmentStatsVector[index]; size_t used = cStats.gcHeapArenaAdmin + - cStats.gcHeapArenaUnused + + cStats.gcHeapUnusedGcThings + cStats.gcHeapObjectsNonFunction + cStats.gcHeapObjectsFunction + cStats.gcHeapStrings + @@ -199,8 +199,8 @@ CollectRuntimeStats(JSRuntime *rt, RuntimeStats *rtStats) #endif cStats.gcHeapTypeObjects; - rtStats->gcHeapChunkDirtyUnused -= used; - rtStats->gcHeapArenaUnused += cStats.gcHeapArenaUnused; + rtStats->gcHeapUnusedArenas -= used; + rtStats->gcHeapUnusedGcThings += cStats.gcHeapUnusedGcThings; rtStats->totalObjects += cStats.gcHeapObjectsNonFunction + cStats.gcHeapObjectsFunction + cStats.objectSlots + @@ -224,17 +224,16 @@ CollectRuntimeStats(JSRuntime *rt, RuntimeStats *rtStats) rtStats->totalAnalysisTemp += cStats.typeInferenceSizes.temporary; } - size_t numDirtyChunks = (rtStats->gcHeapChunkTotal - - rtStats->gcHeapChunkCleanUnused) / - gc::ChunkSize; + size_t numDirtyChunks = + (rtStats->gcHeapChunkTotal - rtStats->gcHeapUnusedChunks) / gc::ChunkSize; size_t perChunkAdmin = sizeof(gc::Chunk) - (sizeof(gc::Arena) * gc::ArenasPerChunk); rtStats->gcHeapChunkAdmin = numDirtyChunks * perChunkAdmin; - rtStats->gcHeapChunkDirtyUnused -= rtStats->gcHeapChunkAdmin; + rtStats->gcHeapUnusedArenas -= rtStats->gcHeapChunkAdmin; - rtStats->gcHeapUnused = rtStats->gcHeapChunkDirtyUnused + - rtStats->gcHeapChunkCleanUnused + - rtStats->gcHeapArenaUnused; + rtStats->gcHeapUnused = rtStats->gcHeapUnusedArenas + + rtStats->gcHeapUnusedChunks + + rtStats->gcHeapUnusedGcThings; rtStats->gcHeapCommitted = rtStats->gcHeapChunkTotal - rtStats->gcHeapChunkCleanDecommitted - diff --git a/js/xpconnect/src/XPCJSRuntime.cpp b/js/xpconnect/src/XPCJSRuntime.cpp index 7b7b3581611..8128b2cdb69 100644 --- a/js/xpconnect/src/XPCJSRuntime.cpp +++ b/js/xpconnect/src/XPCJSRuntime.cpp @@ -1304,11 +1304,11 @@ ReportCompartmentStats(const JS::CompartmentStats &cStats, "bookkeeping information, and (b) to provide padding to " "align GC things."); - CREPORT_GC_BYTES(MakePath(pathPrefix, cStats, "gc-heap/arena/unused"), - cStats.gcHeapArenaUnused, + CREPORT_GC_BYTES(MakePath(pathPrefix, cStats, "gc-heap/unused-gc-things"), + cStats.gcHeapUnusedGcThings, "Memory on the compartment's garbage-collected JavaScript " - "heap, within arenas, that could be holding useful data " - "but currently isn't."); + "heap taken by empty GC thing slots within non-empty " + "arenas."); CREPORT_GC_BYTES(MakePath(pathPrefix, cStats, "gc-heap/objects/non-function"), cStats.gcHeapObjectsNonFunction, @@ -1550,21 +1550,16 @@ ReportJSRuntimeExplicitTreeStats(const JS::RuntimeStats &rtStats, "small and all the same size, so they're not worth reporting " "on a per-compartment basis."); - REPORT_GC_BYTES(pathPrefix + NS_LITERAL_CSTRING("gc-heap-chunk-dirty-unused"), - rtStats.gcHeapChunkDirtyUnused, - "Memory on the garbage-collected JavaScript heap, within " - "chunks with at least one allocated GC thing, that could " - "be holding useful data but currently isn't. Memory here " - "is mutually exclusive with memory reported under " - "'explicit/js/gc-heap-decommitted'."); - - REPORT_GC_BYTES(pathPrefix + NS_LITERAL_CSTRING("gc-heap-chunk-clean-unused"), - rtStats.gcHeapChunkCleanUnused, + REPORT_GC_BYTES(pathPrefix + NS_LITERAL_CSTRING("gc-heap-unused-arenas"), + rtStats.gcHeapUnusedArenas, "Memory on the garbage-collected JavaScript heap taken by " - "completely empty chunks, that soon will be released " - "unless claimed for new allocations. Memory here is " - "mutually exclusive with memory reported under " - "'explicit/js/gc-heap-decommitted'."); + "empty arenas within non-empty chunks."); + + REPORT_GC_BYTES(pathPrefix + NS_LITERAL_CSTRING("gc-heap-unused-chunks"), + rtStats.gcHeapUnusedChunks, + "Memory on the garbage-collected JavaScript heap taken by " + "empty chunks, which will soon be released unless claimed " + "for new allocations."); REPORT_GC_BYTES(pathPrefix + NS_LITERAL_CSTRING("gc-heap-decommitted"), rtStats.gcHeapChunkCleanDecommitted + rtStats.gcHeapChunkDirtyDecommitted, @@ -1711,35 +1706,35 @@ public: nsIMemoryReporter::KIND_HEAP, xpconnect, "Memory used by XPConnect."); - REPORT_BYTES(NS_LITERAL_CSTRING("js-main-runtime-gc-heap-chunk-dirty-unused"), + REPORT_BYTES(NS_LITERAL_CSTRING("js-main-runtime-gc-heap-unused-arenas"), nsIMemoryReporter::KIND_OTHER, - rtStats.gcHeapChunkDirtyUnused, - "The same as 'explicit/js/gc-heap-chunk-dirty-unused'. " + rtStats.gcHeapUnusedArenas, + "The same as 'explicit/js/gc-heap-unused-arenas'. " "Shown here for easy comparison with other 'js-gc' " "reporters."); - REPORT_BYTES(NS_LITERAL_CSTRING("js-main-runtime-gc-heap-chunk-clean-unused"), + REPORT_BYTES(NS_LITERAL_CSTRING("js-main-runtime-gc-heap-unused-chunks"), nsIMemoryReporter::KIND_OTHER, - rtStats.gcHeapChunkCleanUnused, - "The same as 'explicit/js/gc-heap-chunk-clean-unused'. " + rtStats.gcHeapUnusedChunks, + "The same as 'explicit/js/gc-heap-unused-chunks'. " "Shown here for easy comparison with other 'js-gc' " "reporters."); - REPORT_BYTES(NS_LITERAL_CSTRING("js-main-runtime-gc-heap-arena-unused"), + REPORT_BYTES(NS_LITERAL_CSTRING("js-main-runtime-gc-heap-unused-gc-things"), nsIMemoryReporter::KIND_OTHER, - rtStats.gcHeapArenaUnused, + rtStats.gcHeapUnusedGcThings, "Memory on the main JSRuntime's garbage-collected " - "JavaScript heap, within arenas, that could be holding " - "useful data but currently isn't. This is the sum of all " - "compartments' 'gc-heap/arena-unused' numbers."); + "JavaScript heap taken by empty GC thing slots within " + "non-empty arenas. This is the sum of all compartments' " + "'gc-heap/unused-gc-things' numbers."); REPORT_BYTES(NS_LITERAL_CSTRING("js-main-runtime-gc-heap-committed-unused"), nsIMemoryReporter::KIND_OTHER, rtStats.gcHeapUnused, "Amount of the GC heap that's committed, but that is " "neither part of an active allocation nor being used for " - "bookkeeping. Equal to 'gc-heap-chunk-dirty-unused' + " - "'gc-heap-chunk-clean-unused' + 'gc-heap-arena-unused'."); + "bookkeeping. Equal to 'gc-heap-unused-chunks' + " + "'gc-heap-unused-arenas' + 'gc-heap-unused-gc-things'."); // Why 10000x? 100x because it's a percentage, and another 100x // because nsIMemoryReporter requires that for UNITS_PERCENTAGE