зеркало из https://github.com/mozilla/gecko-dev.git
Bug 939137 - part 2 - display memory statistics following each mochitest; r=ted
Landing this on a CLOSED TREE
This commit is contained in:
Родитель
f43f9108f4
Коммит
05473f821b
|
@ -392,6 +392,22 @@ TestRunner.expectChildProcessCrash = function() {
|
|||
TestRunner._expectingProcessCrash = true;
|
||||
};
|
||||
|
||||
/**
|
||||
* Statistics that we want to retrieve and display after every test is
|
||||
* done. The keys of this table are intended to be identical to the
|
||||
* relevant attributes of nsIMemoryReporterManager. However, since
|
||||
* nsIMemoryReporterManager doesn't necessarily support all these
|
||||
* statistics in all build configurations, we also use this table to
|
||||
* tell us whether statistics are supported or not.
|
||||
*/
|
||||
var MEM_STAT_UNKNOWN = 0;
|
||||
var MEM_STAT_UNSUPPORTED = 1;
|
||||
var MEM_STAT_SUPPORTED = 2;
|
||||
TestRunner._hasMemoryStatistics = {}
|
||||
TestRunner._hasMemoryStatistics.vsize = MEM_STAT_UNKNOWN;
|
||||
TestRunner._hasMemoryStatistics.heapAllocated = MEM_STAT_UNKNOWN;
|
||||
TestRunner._hasMemoryStatistics.largestContiguousVMBlock = MEM_STAT_UNKNOWN;
|
||||
|
||||
/**
|
||||
* This stub is called by SimpleTest when a test is finished.
|
||||
**/
|
||||
|
@ -409,6 +425,28 @@ TestRunner.testFinished = function(tests) {
|
|||
TestRunner._lastTestFinished = TestRunner._currentTest;
|
||||
TestRunner._loopIsRestarting = false;
|
||||
|
||||
var mrm = SpecialPowers.Cc["@mozilla.org/memory-reporter-manager;1"]
|
||||
.getService(SpecialPowers.Ci.nsIMemoryReporterManager);
|
||||
for (stat in TestRunner._hasMemoryStatistics) {
|
||||
var supported = TestRunner._hasMemoryStatistics[stat];
|
||||
var firstAccess = false;
|
||||
if (supported == MEM_STAT_UNKNOWN) {
|
||||
firstAccess = true;
|
||||
try {
|
||||
var value = mrm[stat];
|
||||
supported = MEM_STAT_SUPPORTED;
|
||||
} catch (e) {
|
||||
supported = MEM_STAT_UNSUPPORTED;
|
||||
}
|
||||
TestRunner._hasMemoryStatistics[stat] = supported;
|
||||
}
|
||||
if (supported == MEM_STAT_SUPPORTED) {
|
||||
TestRunner.log("TEST-INFO | MEMORY STAT " + stat + " after test: " + mrm[stat]);
|
||||
} else if (firstAccess) {
|
||||
TestRunner.log("TEST-INFO | MEMORY STAT " + stat + " not supported in this build configuration.");
|
||||
}
|
||||
}
|
||||
|
||||
function cleanUpCrashDumpFiles() {
|
||||
if (!SpecialPowers.removeExpectedCrashDumpFiles(TestRunner._expectingProcessCrash)) {
|
||||
TestRunner.error("TEST-UNEXPECTED-FAIL | " +
|
||||
|
|
Загрузка…
Ссылка в новой задаче