Bug 1429510 - Make last shutdown time a scalar. r=chutten,liuche
☠☠ backed out by db7225f74e1f ☠ ☠
authorGeorg Fritzsche <georg.fritzsche@googlemail.com>
Thu, 11 Jan 2018 06:06:00 +0200
changeset 453443 809a14e1c12b4ccca6c328f80719c0f0787128e6
parent 453442 3b640564e1bd83c32a91b0ad719b0fe8cba02098
child 453444 ce5f4fbbebc872f25557afa14342aad95adfa085
push id1648
push usermtabara@mozilla.com
push dateThu, 01 Mar 2018 12:45:47 +0000
treeherdermozilla-release@cbb9688c2eeb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerschutten, liuche
bugs1429510
milestone59.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 1429510 - Make last shutdown time a scalar. r=chutten,liuche
toolkit/components/telemetry/Scalars.yaml
toolkit/components/telemetry/Telemetry.cpp
toolkit/components/telemetry/tests/unit/test_TelemetrySession.js
--- a/toolkit/components/telemetry/Scalars.yaml
+++ b/toolkit/components/telemetry/Scalars.yaml
@@ -1306,16 +1306,33 @@ timestamps:
     expires: never
     kind: uint
     notification_emails:
       - hkirschner@mozilla.com
     release_channel_collection: opt-out
     record_in_processes:
       - main
 
+browser.timings:
+  last_shutdown:
+    bug_numbers:
+      - 1429510
+    description: >
+      The time, in milliseconds, it took to complete the last shutdown.
+      On successful shutdown, Telemetry saves this to disk into Telemetry.ShutdownTime.txt.
+      On the next startup this is loaded and recorded.
+    expires: never
+    kind: uint
+    notification_emails:
+      - florian@mozilla.com
+    release_channel_collection: opt-out
+    record_in_processes:
+      - 'main'
+
+
 # The following section contains the service worker scalars.
 sw:
   synthesized_res_count:
     bug_numbers:
       - 1416629
     description: >
       The count of number of synthesize response made by service workers.
     expires: "61"
--- a/toolkit/components/telemetry/Telemetry.cpp
+++ b/toolkit/components/telemetry/Telemetry.cpp
@@ -307,16 +307,19 @@ public:
     mTelemetry->mCallbacks.Clear();
   }
 
   NS_IMETHOD Run() override {
     LoadFailedLockCount(mTelemetry->mFailedLockCount);
     mTelemetry->mLastShutdownTime =
       ReadLastShutdownDuration(mShutdownTimeFilename);
     mTelemetry->ReadLateWritesStacks(mProfileDir);
+
+    TelemetryScalar::Set(Telemetry::ScalarID::TIMINGS_LAST_SHUTDOWN, mTelemetry->mLastShutdownTime);
+
     nsCOMPtr<nsIRunnable> e =
       NewRunnableMethod("nsFetchTelemetryData::MainThread",
                         this,
                         &nsFetchTelemetryData::MainThread);
     NS_ENSURE_STATE(e);
     NS_DispatchToMainThread(e);
     return NS_OK;
   }
--- a/toolkit/components/telemetry/tests/unit/test_TelemetrySession.js
+++ b/toolkit/components/telemetry/tests/unit/test_TelemetrySession.js
@@ -325,16 +325,20 @@ function checkPayload(payload, reason, s
   Assert.equal(payload.simpleMeasurements.shutdownDuration, SHUTDOWN_TIME);
   Assert.equal(payload.simpleMeasurements.savedPings, savedPings);
   Assert.ok("maximalNumberOfConcurrentThreads" in payload.simpleMeasurements);
   Assert.ok(payload.simpleMeasurements.maximalNumberOfConcurrentThreads >= gNumberOfThreadsLaunched);
 
   let activeTicks = payload.simpleMeasurements.activeTicks;
   Assert.ok(activeTicks >= 0);
 
+  if ("timings.last_shutdown" in payload.processes.parent.scalars) {
+    Assert.equal(payload.processes.parent.scalars["timings.last_shutdown"], SHUTDOWN_TIME);
+  }
+
   Assert.equal(payload.simpleMeasurements.failedProfileLockCount,
               FAILED_PROFILE_LOCK_ATTEMPTS);
   let profileDirectory = Services.dirsvc.get("ProfD", Ci.nsIFile);
   let failedProfileLocksFile = profileDirectory.clone();
   failedProfileLocksFile.append("Telemetry.FailedProfileLocks.txt");
   Assert.ok(!failedProfileLocksFile.exists());