Bug 1653671 - Add aMinimizeMemoryUsage argument to dumpMemoryReportsToNamedFile(). r=froydnj

This functionality already exists, so it is just a matter of threading
an extra bool around. This patch should not actually change the behavior
anywhere.

The goal of this is to consider using it for AWSY. Currently AWSY
asks every process to minimize memory usage at once, but with
this option the minimization will be batched along with the memory
reports, which should make it less likely to overwhelm the system
when there are a lot of content processes.

Differential Revision: https://phabricator.services.mozilla.com/D87475
This commit is contained in:
Andrew McCreight 2020-08-21 17:11:03 +00:00
Родитель d1d6b661e3
Коммит 4e95b07530
8 изменённых файлов: 22 добавлений и 12 удалений

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

@ -222,7 +222,8 @@ class AwsyTestCase(MarionetteTestCase):
"%s",
() => resolve("memory report done!"),
null,
/* anonymize */ false);
/* anonymize */ false,
/* minimize memory usage */ false);
""" % checkpoint_path
checkpoint = None

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

@ -112,7 +112,8 @@ MemoryStats.dump = function(
info("TEST-INFO | " + testURL + " | MEMDUMP-END");
},
null,
/* anonymize = */ false
/* anonymize = */ false,
/* minimize memory usage = */ false
);
}

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

@ -2400,7 +2400,8 @@ function saveReportsToFile() {
aFile.path,
finishDumping,
null,
gAnonymize.checked
gAnonymize.checked,
/* minimize memory usage = */ false
);
};

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

@ -139,7 +139,8 @@
let dumper = Cc["@mozilla.org/memory-info-dumper;1"].
getService(Ci.nsIMemoryInfoDumper);
dumper.dumpMemoryReportsToNamedFile(filePath, loadAndCheck, null,
/* anonymize = */ false);
/* anonymize = */ false,
/* minimize memory usage = */ false);
} else {
loadAndCheck();
}

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

@ -84,7 +84,8 @@
let dumper = Cc["@mozilla.org/memory-info-dumper;1"].
getService(Ci.nsIMemoryInfoDumper);
dumper.dumpMemoryReportsToNamedFile(filePath, loadAndCheck, null,
/* anonymize = */ false);
/* anonymize = */ false,
/* minimize memory usage = */ false);
function loadAndCheck() {
// Load the file.

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

@ -1205,8 +1205,8 @@ nsXULAppInfo::SaveMemoryReport() {
return NS_ERROR_UNEXPECTED;
}
rv = dumper->DumpMemoryReportsToNamedFile(path, this, file,
true /* anonymize */);
rv = dumper->DumpMemoryReportsToNamedFile(
path, this, file, true /* anonymize */, false /* minimizeMemoryUsage */);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}

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

@ -59,6 +59,10 @@ interface nsIMemoryInfoDumper : nsISupports
*
* @param aAnonymize Should the reports be anonymized?
*
* @param aMinimizeMemoryUsage indicates whether we should run a series of
* GC/CC's in an attempt to reduce our memory usage before collecting our
* memory report.
*
* Sample output, annotated with comments for explanatory purposes.
*
* {
@ -86,7 +90,8 @@ interface nsIMemoryInfoDumper : nsISupports
void dumpMemoryReportsToNamedFile(in AString aFilename,
in nsIFinishDumpingCallback aFinishDumping,
in nsISupports aFinishDumpingData,
in boolean aAnonymize);
in boolean aAnonymize,
in boolean aMinimizeMemoryUsage);
/**
* Similar to dumpMemoryReportsToNamedFile, this method dumps gzipped memory
@ -111,7 +116,7 @@ interface nsIMemoryInfoDumper : nsISupports
* @param aAnonymize Should the reports be anonymized?
*
* @param aMinimizeMemoryUsage indicates whether we should run a series of
* gc/cc's in an attempt to reduce our memory usage before collecting our
* GC/CC's in an attempt to reduce our memory usage before collecting our
* memory report.
*/
void dumpMemoryInfoToTempDir(

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

@ -615,7 +615,8 @@ static nsresult DumpMemoryInfoToFile(nsIFile* aReportsFile,
NS_IMETHODIMP
nsMemoryInfoDumper::DumpMemoryReportsToNamedFile(
const nsAString& aFilename, nsIFinishDumpingCallback* aFinishDumping,
nsISupports* aFinishDumpingData, bool aAnonymize) {
nsISupports* aFinishDumpingData, bool aAnonymize,
bool aMinimizeMemoryUsage) {
MOZ_ASSERT(!aFilename.IsEmpty());
// Create the file.
@ -646,8 +647,7 @@ nsMemoryInfoDumper::DumpMemoryReportsToNamedFile(
nsString dmdIdent = EmptyString();
return DumpMemoryInfoToFile(reportsFile, aFinishDumping, aFinishDumpingData,
aAnonymize, /* minimizeMemoryUsage = */ false,
dmdIdent);
aAnonymize, aMinimizeMemoryUsage, dmdIdent);
}
NS_IMETHODIMP