Bug 805915 (part 2) - Add more detail to object memory reports. r=luke.

--HG--
extra : rebase_source : e54ece88753280ccac284f6265fd92310dc1bec6
This commit is contained in:
Nicholas Nethercote 2012-10-29 08:51:21 +11:00
Родитель 9c33f3f643
Коммит fe068d7611
3 изменённых файлов: 46 добавлений и 9 удалений

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

@ -129,8 +129,11 @@ struct CompartmentStats
, extra2(0)
, gcHeapArenaAdmin(0)
, gcHeapUnusedGcThings(0)
, gcHeapObjectsNonFunction(0)
, gcHeapObjectsOrdinary(0)
, gcHeapObjectsFunction(0)
, gcHeapObjectsDenseArray(0)
, gcHeapObjectsSlowArray(0)
, gcHeapObjectsCrossCompartmentWrapper(0)
, gcHeapStrings(0)
, gcHeapShapesTree(0)
, gcHeapShapesDict(0)
@ -164,8 +167,11 @@ struct CompartmentStats
, extra2(other.extra2)
, gcHeapArenaAdmin(other.gcHeapArenaAdmin)
, gcHeapUnusedGcThings(other.gcHeapUnusedGcThings)
, gcHeapObjectsNonFunction(other.gcHeapObjectsNonFunction)
, gcHeapObjectsOrdinary(other.gcHeapObjectsOrdinary)
, gcHeapObjectsFunction(other.gcHeapObjectsFunction)
, gcHeapObjectsDenseArray(other.gcHeapObjectsDenseArray)
, gcHeapObjectsSlowArray(other.gcHeapObjectsSlowArray)
, gcHeapObjectsCrossCompartmentWrapper(other.gcHeapObjectsCrossCompartmentWrapper)
, gcHeapStrings(other.gcHeapStrings)
, gcHeapShapesTree(other.gcHeapShapesTree)
, gcHeapShapesDict(other.gcHeapShapesDict)
@ -206,8 +212,11 @@ struct CompartmentStats
size_t gcHeapArenaAdmin;
size_t gcHeapUnusedGcThings;
size_t gcHeapObjectsNonFunction;
size_t gcHeapObjectsOrdinary;
size_t gcHeapObjectsFunction;
size_t gcHeapObjectsDenseArray;
size_t gcHeapObjectsSlowArray;
size_t gcHeapObjectsCrossCompartmentWrapper;
size_t gcHeapStrings;
size_t gcHeapShapesTree;
size_t gcHeapShapesDict;
@ -247,8 +256,11 @@ struct CompartmentStats
ADD(gcHeapArenaAdmin);
ADD(gcHeapUnusedGcThings);
ADD(gcHeapObjectsNonFunction);
ADD(gcHeapObjectsOrdinary);
ADD(gcHeapObjectsFunction);
ADD(gcHeapObjectsDenseArray);
ADD(gcHeapObjectsSlowArray);
ADD(gcHeapObjectsCrossCompartmentWrapper);
ADD(gcHeapStrings);
ADD(gcHeapShapesTree);
ADD(gcHeapShapesDict);

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

@ -54,8 +54,11 @@ CompartmentStats::gcHeapThingsSize()
{
// These are just the GC-thing measurements.
size_t n = 0;
n += gcHeapObjectsNonFunction;
n += gcHeapObjectsOrdinary;
n += gcHeapObjectsFunction;
n += gcHeapObjectsDenseArray;
n += gcHeapObjectsSlowArray;
n += gcHeapObjectsCrossCompartmentWrapper;
n += gcHeapStrings;
n += gcHeapShapesTree;
n += gcHeapShapesDict;
@ -141,8 +144,14 @@ StatsCellCallback(JSRuntime *rt, void *data, void *thing, JSGCTraceKind traceKin
JSObject *obj = static_cast<JSObject *>(thing);
if (obj->isFunction()) {
cStats->gcHeapObjectsFunction += thingSize;
} else if (obj->isDenseArray()) {
cStats->gcHeapObjectsDenseArray += thingSize;
} else if (obj->isSlowArray()) {
cStats->gcHeapObjectsSlowArray += thingSize;
} else if (obj->isCrossCompartmentWrapper()) {
cStats->gcHeapObjectsCrossCompartmentWrapper += thingSize;
} else {
cStats->gcHeapObjectsNonFunction += thingSize;
cStats->gcHeapObjectsOrdinary += thingSize;
}
size_t slotsSize, elementsSize, miscSize;
obj->sizeOfExcludingThis(rtStats->mallocSizeOf, &slotsSize,

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

@ -1471,16 +1471,32 @@ ReportCompartmentStats(const JS::CompartmentStats &cStats,
"heap taken by empty GC thing slots within non-empty "
"arenas.");
CREPORT_GC_BYTES(cJSPathPrefix + NS_LITERAL_CSTRING("gc-heap/objects/non-function"),
cStats.gcHeapObjectsNonFunction,
CREPORT_GC_BYTES(cJSPathPrefix + NS_LITERAL_CSTRING("gc-heap/objects/ordinary"),
cStats.gcHeapObjectsOrdinary,
"Memory on the garbage-collected JavaScript "
"heap that holds non-function objects.");
"heap that holds ordinary (i.e. not otherwise distinguished "
"my memory reporters) objects.");
CREPORT_GC_BYTES(cJSPathPrefix + NS_LITERAL_CSTRING("gc-heap/objects/function"),
cStats.gcHeapObjectsFunction,
"Memory on the garbage-collected JavaScript "
"heap that holds function objects.");
CREPORT_GC_BYTES(cJSPathPrefix + NS_LITERAL_CSTRING("gc-heap/objects/dense-array"),
cStats.gcHeapObjectsDenseArray,
"Memory on the garbage-collected JavaScript "
"heap that holds dense array objects.");
CREPORT_GC_BYTES(cJSPathPrefix + NS_LITERAL_CSTRING("gc-heap/objects/slow-array"),
cStats.gcHeapObjectsSlowArray,
"Memory on the garbage-collected JavaScript "
"heap that holds slow array objects.");
CREPORT_GC_BYTES(cJSPathPrefix + NS_LITERAL_CSTRING("gc-heap/objects/cross-compartment-wrapper"),
cStats.gcHeapObjectsCrossCompartmentWrapper,
"Memory on the garbage-collected JavaScript "
"heap that holds cross-compartment wrapper objects.");
CREPORT_GC_BYTES(cJSPathPrefix + NS_LITERAL_CSTRING("gc-heap/strings"),
cStats.gcHeapStrings,
"Memory on the garbage-collected JavaScript "