Bug 1257209 - record uptime in crash metadata/pings, r=gfritzsche a=ritu CLOSED TREE
authorBenjamin Smedberg <benjamin@smedbergs.us>
Wed, 16 Mar 2016 16:59:06 -0400
changeset 323582 b424b3c0b111bc34487a235e32b438f53603d998
parent 323581 80f951606890665f6415bbae8ac728bedc0715ea
child 323583 f601dc16ab452d44f545181aa0a0f67920e308fb
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgfritzsche, ritu
bugs1257209
milestone47.0a2
Bug 1257209 - record uptime in crash metadata/pings, r=gfritzsche a=ritu CLOSED TREE 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
@@ -865,17 +865,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));
 });