Bug 1464773 - Add low-memory event counts to the crash report; r?ted.mielczarek
MozReview-Commit-ID: 9hf31FSigrI
--- a/mobile/android/base/java/org/mozilla/gecko/telemetry/pingbuilders/TelemetryCrashPingBuilder.java
+++ b/mobile/android/base/java/org/mozilla/gecko/telemetry/pingbuilders/TelemetryCrashPingBuilder.java
@@ -44,16 +44,17 @@ public class TelemetryCrashPingBuilder e
"BlockedDllList",
"BlocklistInitFailed",
"BuildID",
"ContainsMemoryReport",
"CrashTime",
"EventLoopNestingLevel",
"ipc_channel_error",
"IsGarbageCollecting",
+ "LowCommitSpaceEvents",
"MozCrashReason",
"OOMAllocationSize",
"ProductID",
"ProductName",
"ReleaseChannel",
"RemoteType",
"SecondsSinceLastCrash",
"ShutdownProgress",
--- a/toolkit/components/crashes/CrashManager.jsm
+++ b/toolkit/components/crashes/CrashManager.jsm
@@ -222,16 +222,17 @@ this.CrashManager.prototype = Object.fre
EVENT_FILE_ERROR_UNKNOWN_EVENT: "unknown-event",
// A whitelist of crash annotations which do not contain sensitive data
// and are saved in the crash record and sent with Firefox Health Report.
ANNOTATION_WHITELIST: [
"AsyncShutdownTimeout",
"BuildID",
"ipc_channel_error",
+ "LowCommitSpaceEvents",
"ProductID",
"ProductName",
"ReleaseChannel",
"RemoteType",
"SecondsSinceLastCrash",
"ShutdownProgress",
"StartupCrash",
"TelemetryEnvironment",
--- a/toolkit/components/telemetry/docs/data/crash-ping.rst
+++ b/toolkit/components/telemetry/docs/data/crash-ping.rst
@@ -56,16 +56,17 @@ Structure:
AvailableVirtualMemory: <size>, // Windows-only, available virtual memory in bytes
BlockedDllList: <list>, // Windows-only, see WindowsDllBlocklist.cpp for details
BlocklistInitFailed: "1", // Windows-only, present only if the DLL blocklist initialization failed
CrashTime: <time>, // Seconds since the Epoch
ContainsMemoryReport: "1", // Optional, if set indicates that the crash had a memory report attached
EventLoopNestingLevel: <levels>, // Optional, present only if >0, indicates the nesting level of the event-loop
ipc_channel_error: <error string>, // Optional, contains the string processing error reason for an ipc-based content crash
IsGarbageCollecting: "1", // Optional, if set indicates that the crash occurred while the garbage collector was running
+ LowCommitSpaceEvents: <num>, // Windows-only, present only if >0, number of low commit space events detected by the available memory tracker
MozCrashReason: <reason>, // Optional, contains the string passed to MOZ_CRASH()
OOMAllocationSize: <size>, // Size of the allocation that caused an OOM
RemoteType: <type>, // Optional, type of content process, see below for a list of types
SecondsSinceLastCrash: <duration>, // Seconds elapsed since the last crash occurred
ShutdownProgress: <phase>, // Optional, contains a string describing the shutdown phase in which the crash occurred
SystemMemoryUsePercentage: <percentage>, // Windows-only, percent of memory in use
StartupCrash: "1", // Optional, if set indicates that Firefox crashed during startup
TelemetrySessionId: <id>, // Active telemetry session ID when the crash was recorded
--- a/toolkit/crashreporter/client/ping.cpp
+++ b/toolkit/crashreporter/client/ping.cpp
@@ -129,16 +129,17 @@ CreateMetadataNode(StringTable& strings)
"BlockedDllList",
"BlocklistInitFailed",
"BuildID",
"ContainsMemoryReport",
"CrashTime",
"EventLoopNestingLevel",
"ipc_channel_error",
"IsGarbageCollecting",
+ "LowCommitSpaceEvents",
"MozCrashReason",
"OOMAllocationSize",
"ProductID",
"ProductName",
"ReleaseChannel",
"RemoteType",
"SecondsSinceLastCrash",
"ShutdownProgress",
--- a/xpcom/base/AvailableMemoryTracker.cpp
+++ b/xpcom/base/AvailableMemoryTracker.cpp
@@ -4,18 +4,20 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/AvailableMemoryTracker.h"
#if defined(XP_WIN)
#include "prinrval.h"
#include "prenv.h"
+#include "nsExceptionHandler.h"
#include "nsIMemoryReporter.h"
#include "nsMemoryPressure.h"
+#include "nsPrintfCString.h"
#endif
#include "nsIObserver.h"
#include "nsIObserverService.h"
#include "nsIRunnable.h"
#include "nsISupports.h"
#include "nsITimer.h"
#include "nsThreadUtils.h"
@@ -350,16 +352,19 @@ nsAvailableMemoryWatcher::IsVirtualMemor
}
/* static */ bool
nsAvailableMemoryWatcher::IsCommitSpaceLow(const MEMORYSTATUSEX& aStat)
{
if ((kLowCommitSpaceThreshold != 0) &&
(aStat.ullAvailPageFile < kLowCommitSpaceThreshold)) {
sNumLowCommitSpaceEvents++;
+ CrashReporter::AnnotateCrashReport(
+ NS_LITERAL_CSTRING("LowCommitSpaceEvents"),
+ nsPrintfCString("%" PRIu32, uint32_t(sNumLowCommitSpaceEvents)));
return true;
}
return false;
}
/* static */ bool
nsAvailableMemoryWatcher::IsPhysicalMemoryLow(const MEMORYSTATUSEX& aStat)