Bug 1257209 - record uptime in crash metadata/pings, r=gfritzsche
authorBenjamin Smedberg <benjamin@smedbergs.us>
Wed, 16 Mar 2016 16:59:06 -0400
changeset 289369 42829091251264218bd423aa161c29961d3e6e2d
parent 289368 e4efc904501f210f9cfca57b0b6742c1ec42c430
child 289370 ce85118f049d36cf875b3228495b993473717583
push id73808
push userbsmedberg@mozilla.com
push dateFri, 18 Mar 2016 17:35:27 +0000
treeherdermozilla-inbound@428290912512 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgfritzsche
bugs1257209
milestone48.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1257209 - record uptime in crash metadata/pings, r=gfritzsche MozReview-Commit-ID: 8MVRwALXvW5
toolkit/crashreporter/nsExceptionHandler.cpp
toolkit/crashreporter/test/unit/test_event_files.js
--- a/toolkit/crashreporter/nsExceptionHandler.cpp
+++ b/toolkit/crashreporter/nsExceptionHandler.cpp
@@ -921,17 +921,20 @@ bool MinidumpCallback(
 #ifdef XP_LINUX
       OpenAPIData(apiData, descriptor.path());
 #else
       OpenAPIData(apiData, dump_path, minidump_id);
 #endif
       apiData.WriteBuffer(crashReporterAPIData->get(), crashReporterAPIData->Length());
     }
     WriteAnnotation(apiData, "CrashTime", crashTimeString);
+    WriteAnnotation(eventFile, "CrashTime", crashTimeString);
+
     WriteAnnotation(apiData, "UptimeTS", uptimeTSString);
+    WriteAnnotation(eventFile, "UptimeTS", uptimeTSString);
 
     if (timeSinceLastCrash != 0) {
       WriteAnnotation(apiData, "SecondsSinceLastCrash",
                       timeSinceLastCrashString);
       WriteAnnotation(eventFile, "SecondsSinceLastCrash",
                       timeSinceLastCrashString);
     }
     if (isGarbageCollecting) {
--- a/toolkit/crashreporter/test/unit/test_event_files.js
+++ b/toolkit/crashreporter/test/unit/test_event_files.js
@@ -44,10 +44,13 @@ add_task(function* test_main_process_cra
   Assert.equal(count, 1, "A single crash event file was seen.");
   let crashes = yield cm.getCrashes();
   Assert.equal(crashes.length, 1);
   let crash = crashes[0];
   Assert.ok(crash.isOfType(cm.PROCESS_TYPE_MAIN, cm.CRASH_TYPE_CRASH));
   Assert.equal(crash.id + ".dmp", basename, "ID recorded properly");
   Assert.equal(crash.metadata.ShutdownProgress, "event-test");
   Assert.ok("TelemetrySessionId" in crash.metadata);
+  Assert.ok("UptimeTS" in crash.metadata);
   Assert.ok(/^[0-9a-f]{8}\-([0-9a-f]{4}\-){3}[0-9a-f]{12}$/.test(crash.metadata.TelemetrySessionId));
+  Assert.ok("CrashTime" in crash.metadata);
+  Assert.ok(/^\d+$/.test(crash.metadata.CrashTime));
 });