Bug 697016 - Add js-total-* memory reports. r=bhackett.

This commit is contained in:
Nicholas Nethercote 2011-10-27 22:20:36 -07:00
Родитель 320ae36cfa
Коммит 6ec5c499b1
2 изменённых файлов: 91 добавлений и 3 удалений

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

@ -1577,7 +1577,6 @@ CollectCompartmentStatsForRuntime(JSRuntime *rt, IterateData *data)
// subtract used space from it each time around the loop.
data->gcHeapChunkDirtyUnused = data->gcHeapChunkTotal -
data->gcHeapChunkCleanUnused;
data->gcHeapArenaUnused = 0;
for (PRUint32 index = 0;
index < data->compartmentStatsVector.Length();
@ -1598,6 +1597,29 @@ CollectCompartmentStatsForRuntime(JSRuntime *rt, IterateData *data)
data->gcHeapChunkDirtyUnused -= used;
data->gcHeapArenaUnused += stats.gcHeapArenaUnused;
data->totalObjects += stats.gcHeapObjectsNonFunction +
stats.gcHeapObjectsFunction +
stats.objectSlots;
data->totalShapes += stats.gcHeapShapesTree +
stats.gcHeapShapesDict +
stats.shapesExtraTreeTables +
stats.shapesExtraDictTables +
stats.typeInferenceMemory.emptyShapes;
data->totalScripts += stats.gcHeapScripts +
stats.scriptData;
data->totalStrings += stats.gcHeapStrings +
stats.stringChars;
#ifdef JS_METHODJIT
data->totalMjit += stats.mjitCodeMethod +
stats.mjitCodeRegexp +
stats.mjitCodeUnused +
stats.mjitData;
#endif
data->totalTypeInference += stats.gcHeapTypeObjects +
stats.typeInferenceMemory.objects +
stats.typeInferenceMemory.scripts +
stats.typeInferenceMemory.tables;
data->totalAnalysisTemp += stats.typeInferenceMemory.temporary;
}
size_t numDirtyChunks = (data->gcHeapChunkTotal -
@ -1752,10 +1774,11 @@ ReportCompartmentStats(const CompartmentStats &stats,
callback, closure);
ReportMemoryBytes0(MakeMemoryReporterPath(pathPrefix, stats.name,
"object-empty-shapes"),
"shapes-extra/empty-shape-arrays"),
nsIMemoryReporter::KIND_HEAP,
stats.typeInferenceMemory.emptyShapes,
"Arrays attached to prototype JS objects managing shape information.",
"Memory used for arrays attached to prototype JS objects managing shape "
"information.",
callback, closure);
ReportMemoryBytes0(MakeMemoryReporterPath(pathPrefix, stats.name,
@ -1967,6 +1990,53 @@ public:
"'js-gc-heap'.",
callback, closure);
ReportMemoryBytes(NS_LITERAL_CSTRING("js-total-objects"),
nsIMemoryReporter::KIND_OTHER, data.totalObjects,
"Memory used for all object-related data. This is the sum of all "
"compartments' 'gc-heap/objects-non-function', "
"'gc-heap/objects-function' and 'object-slots' numbers.",
callback, closure);
ReportMemoryBytes(NS_LITERAL_CSTRING("js-total-shapes"),
nsIMemoryReporter::KIND_OTHER, data.totalShapes,
"Memory used for all shape-related data. This is the sum of all "
"compartments' 'gc-heap/shapes/tree', 'gc-heap/shapes/dict', "
"'shapes-extra/tree-tables', 'shapes-extra/dict-tables', "
"'shapes-extra/tree-shape-kids' and 'shapes-extra/empty-shape-arrays'.",
callback, closure);
ReportMemoryBytes(NS_LITERAL_CSTRING("js-total-scripts"),
nsIMemoryReporter::KIND_OTHER, data.totalScripts,
"Memory used for all script-related data. This is the sum of all "
"compartments' 'gc-heap/scripts' and 'script-data' numbers.",
callback, closure);
ReportMemoryBytes(NS_LITERAL_CSTRING("js-total-strings"),
nsIMemoryReporter::KIND_OTHER, data.totalStrings,
"Memory used for all string-related data. This is the sum of all "
"compartments' 'gc-heap/strings' and 'string-chars' numbers.",
callback, closure);
#ifdef JS_METHODJIT
ReportMemoryBytes(NS_LITERAL_CSTRING("js-total-mjit"),
nsIMemoryReporter::KIND_OTHER, data.totalMjit,
"Memory used by the method JIT. This is the sum of all compartments' "
"'mjit-code-method', 'mjit-code-regexp', 'mjit-code-unused' and '"
"'mjit-data' numbers.",
callback, closure);
#endif
ReportMemoryBytes(NS_LITERAL_CSTRING("js-total-type-inference"),
nsIMemoryReporter::KIND_OTHER, data.totalTypeInference,
"Non-transient memory used by type inference. This is the sum of all "
"compartments' 'gc-heap/type-objects', 'type-inference/script-main', "
"'type-inference/object-main' and 'type-inference/tables' numbers.",
callback, closure);
ReportMemoryBytes(NS_LITERAL_CSTRING("js-total-analysis-temporary"),
nsIMemoryReporter::KIND_OTHER, data.totalAnalysisTemp,
"Transient memory used during type inference and compilation. "
"This is the sum of all compartments' 'analysis-temporary' numbers.",
callback, closure);
return NS_OK;
}
};

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

@ -240,6 +240,15 @@ struct IterateData
gcHeapArenaUnused(0),
gcHeapChunkAdmin(0),
gcHeapUnusedPercentage(0),
totalObjects(0),
totalShapes(0),
totalScripts(0),
totalStrings(0),
#ifdef JS_METHODJIT
totalMjit(0),
#endif
totalTypeInference(0),
totalAnalysisTemp(0),
compartmentStatsVector(),
currCompartmentStats(NULL) { }
@ -252,6 +261,15 @@ struct IterateData
PRInt64 gcHeapArenaUnused;
PRInt64 gcHeapChunkAdmin;
PRInt64 gcHeapUnusedPercentage;
PRInt64 totalObjects;
PRInt64 totalShapes;
PRInt64 totalScripts;
PRInt64 totalStrings;
#ifdef JS_METHODJIT
PRInt64 totalMjit;
#endif
PRInt64 totalTypeInference;
PRInt64 totalAnalysisTemp;
nsTArray<CompartmentStats> compartmentStatsVector;
CompartmentStats *currCompartmentStats;