Bug 1257209 - record uptime in crash metadata/pings, r=gfritzsche a=ritu
authorBenjamin Smedberg <benjamin@smedbergs.us>
Wed, 16 Mar 2016 16:59:06 -0400
changeset 317614 ceb34be0c797ed484862a6168a82fcb4d24aec41
parent 317613 a88d785922fce242ee4ee169a7b1982a1373d69b
child 317615 b2bc679410410214e1fd9953deb1439182332aa5
push id5812
push userbsmedberg@mozilla.com
push dateThu, 24 Mar 2016 20:40:45 +0000
treeherdermozilla-beta@ceb34be0c797 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgfritzsche, ritu
bugs1257209
milestone46.0
Bug 1257209 - record uptime in crash metadata/pings, r=gfritzsche a=ritu 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
@@ -853,17 +853,20 @@ bool MinidumpCallback(
     }
 
     if (!crashReporterAPIData->IsEmpty()) {
       // write out API data
       apiData.Open(extraDataPath);
       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));
 });