mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-01 22:07:41 +00:00
Bug 890135 - Switch B2G's "gc log" dumping to produce all-traces logs by default. r=mccr8
This patch also adds "abbreviated gc log", which produces a not-all-traces CC log. --HG-- extra : rebase_source : 84eed72c34b7cc8116fbe05258f5de22bf3275bc
This commit is contained in:
parent
cfb85cffaf
commit
b1b83ab016
@ -512,12 +512,13 @@ ContentChild::RecvDumpMemoryInfoToTempDir(const nsString& aIdentifier,
|
||||
|
||||
bool
|
||||
ContentChild::RecvDumpGCAndCCLogsToFile(const nsString& aIdentifier,
|
||||
const bool& aDumpAllTraces,
|
||||
const bool& aDumpChildProcesses)
|
||||
{
|
||||
nsCOMPtr<nsIMemoryInfoDumper> dumper = do_GetService("@mozilla.org/memory-info-dumper;1");
|
||||
|
||||
dumper->DumpGCAndCCLogsToFile(
|
||||
aIdentifier, aDumpChildProcesses);
|
||||
dumper->DumpGCAndCCLogsToFile(aIdentifier, aDumpAllTraces,
|
||||
aDumpChildProcesses);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -125,6 +125,7 @@ public:
|
||||
const bool& aDumpChildProcesses);
|
||||
virtual bool
|
||||
RecvDumpGCAndCCLogsToFile(const nsString& aIdentifier,
|
||||
const bool& aDumpAllTraces,
|
||||
const bool& aDumpChildProcesses);
|
||||
|
||||
virtual PTestShellChild* AllocPTestShellChild();
|
||||
|
@ -317,6 +317,7 @@ child:
|
||||
* MemoryInfoDumper::dumpGCAndCCLogsToFile.
|
||||
*/
|
||||
async DumpGCAndCCLogsToFile(nsString identifier,
|
||||
bool dumpAllTraces,
|
||||
bool dumpChildProcesses);
|
||||
|
||||
PTestShell();
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[scriptable, builtinclass, uuid(73d23ad8-e77c-4079-b8c0-d71bf0ebc5b2)]
|
||||
[scriptable, builtinclass, uuid(3FFA5113-2A10-43BB-923B-6A2FAF67BE97)]
|
||||
interface nsIMemoryInfoDumper : nsISupports
|
||||
{
|
||||
/**
|
||||
@ -131,10 +131,22 @@ interface nsIMemoryInfoDumper : nsISupports
|
||||
* arbitrary value; for example, it may set aIdentifier to the number
|
||||
* of seconds since the epoch.
|
||||
*
|
||||
* @param aDumpAllTraces indicates whether we should run an all-traces CC
|
||||
* log. An all-traces log visits all objects currently eligible for cycle
|
||||
* collection, while a non-all-traces log avoids visiting some objects
|
||||
* which we know are reachable.
|
||||
*
|
||||
* All-traces logs are much bigger than the alternative, but they may be
|
||||
* helpful when trying to understand why a particular object is alive. For
|
||||
* example, a non-traces-log will skip references held by an active
|
||||
* document; if your object is being held alive by such a document, you
|
||||
* probably want to see those references.
|
||||
*
|
||||
* @param aDumpChildProcesses indicates whether we should call
|
||||
* DumpGCAndCCLogsToFile in our child processes. If so, the child processes
|
||||
* will dump their children, and so on.
|
||||
*/
|
||||
void dumpGCAndCCLogsToFile(in AString aIdentifier,
|
||||
in bool aDumpAllTraces,
|
||||
in bool aDumpChildProcesses);
|
||||
};
|
||||
|
@ -81,21 +81,26 @@ class GCAndCCLogDumpRunnable : public nsRunnable
|
||||
{
|
||||
public:
|
||||
GCAndCCLogDumpRunnable(const nsAString& aIdentifier,
|
||||
bool aDumpAllTraces,
|
||||
bool aDumpChildProcesses)
|
||||
: mIdentifier(aIdentifier)
|
||||
, mDumpAllTraces(aDumpAllTraces)
|
||||
, mDumpChildProcesses(aDumpChildProcesses)
|
||||
{}
|
||||
|
||||
NS_IMETHOD Run()
|
||||
{
|
||||
nsCOMPtr<nsIMemoryInfoDumper> dumper = do_GetService("@mozilla.org/memory-info-dumper;1");
|
||||
nsCOMPtr<nsIMemoryInfoDumper> dumper =
|
||||
do_GetService("@mozilla.org/memory-info-dumper;1");
|
||||
|
||||
dumper->DumpGCAndCCLogsToFile(
|
||||
mIdentifier, mDumpChildProcesses);
|
||||
mIdentifier, mDumpAllTraces, mDumpChildProcesses);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
const nsString mIdentifier;
|
||||
const bool mDumpAllTraces;
|
||||
const bool mDumpChildProcesses;
|
||||
};
|
||||
|
||||
@ -357,6 +362,7 @@ public:
|
||||
nsRefPtr<GCAndCCLogDumpRunnable> runnable =
|
||||
new GCAndCCLogDumpRunnable(
|
||||
/* identifier = */ EmptyString(),
|
||||
/* allTraces = */ true,
|
||||
/* dumpChildProcesses = */ true);
|
||||
NS_DispatchToMainThread(runnable);
|
||||
}
|
||||
@ -500,7 +506,8 @@ public:
|
||||
|
||||
bool doMemoryReport = inputStr == NS_LITERAL_CSTRING("memory report");
|
||||
bool doMMUMemoryReport = inputStr == NS_LITERAL_CSTRING("minimize memory report");
|
||||
bool doGCCCDump = inputStr == NS_LITERAL_CSTRING("gc log");
|
||||
bool doAllTracesGCCCDump = inputStr == NS_LITERAL_CSTRING("gc log");
|
||||
bool doSmallGCCCDump = inputStr == NS_LITERAL_CSTRING("abbreviated gc log");
|
||||
|
||||
if (doMemoryReport || doMMUMemoryReport) {
|
||||
LOG("FifoWatcher dispatching memory report runnable.");
|
||||
@ -509,11 +516,12 @@ public:
|
||||
doMMUMemoryReport,
|
||||
/* dumpChildProcesses = */ true);
|
||||
NS_DispatchToMainThread(runnable);
|
||||
} else if (doGCCCDump) {
|
||||
} else if (doAllTracesGCCCDump || doSmallGCCCDump) {
|
||||
LOG("FifoWatcher dispatching GC/CC log runnable.");
|
||||
nsRefPtr<GCAndCCLogDumpRunnable> runnable =
|
||||
new GCAndCCLogDumpRunnable(
|
||||
/* identifier = */ EmptyString(),
|
||||
doAllTracesGCCCDump,
|
||||
/* dumpChildProcesses = */ true);
|
||||
NS_DispatchToMainThread(runnable);
|
||||
} else {
|
||||
@ -561,6 +569,7 @@ EnsureNonEmptyIdentifier(nsAString& aIdentifier)
|
||||
NS_IMETHODIMP
|
||||
nsMemoryInfoDumper::DumpGCAndCCLogsToFile(
|
||||
const nsAString& aIdentifier,
|
||||
bool aDumpAllTraces,
|
||||
bool aDumpChildProcesses)
|
||||
{
|
||||
nsString identifier(aIdentifier);
|
||||
@ -571,7 +580,7 @@ nsMemoryInfoDumper::DumpGCAndCCLogsToFile(
|
||||
ContentParent::GetAll(children);
|
||||
for (uint32_t i = 0; i < children.Length(); i++) {
|
||||
unused << children[i]->SendDumpGCAndCCLogsToFile(
|
||||
identifier, aDumpChildProcesses);
|
||||
identifier, aDumpAllTraces, aDumpChildProcesses);
|
||||
}
|
||||
}
|
||||
|
||||
@ -579,6 +588,12 @@ nsMemoryInfoDumper::DumpGCAndCCLogsToFile(
|
||||
do_CreateInstance("@mozilla.org/cycle-collector-logger;1");
|
||||
logger->SetFilenameIdentifier(identifier);
|
||||
|
||||
if (aDumpAllTraces) {
|
||||
nsCOMPtr<nsICycleCollectorListener> allTracesLogger;
|
||||
logger->AllTraces(getter_AddRefs(allTracesLogger));
|
||||
logger = allTracesLogger;
|
||||
}
|
||||
|
||||
nsJSContext::CycleCollectNow(logger);
|
||||
return NS_OK;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user