Bug 1340134 - Use idleDispatch for gathering memory statistics. r=chutten
authorEric Rahm <erahm@mozilla.com>
Fri, 23 Jun 2017 15:36:00 -0700
changeset 367067 499b44c627e9d5e18584f0b58212264500b5bc51
parent 367066 6d86960c7c4972225fd10a9d5e4ef5c3309e1da2
child 367068 8c0a3de985d41f7fad4118e30a011659b01e8e3a
push id32117
push userphilringnalda@gmail.com
push dateSun, 02 Jul 2017 00:39:30 +0000
treeherdermozilla-central@4d3de12dcdc5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerschutten
bugs1340134
milestone56.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 1340134 - Use idleDispatch for gathering memory statistics. r=chutten This defers the |gatherMemory| telemetry measurement until we're idle. This measurement should no longer affect CC times. MozReview-Commit-ID: DMtAo3K59FV
toolkit/components/telemetry/TelemetrySession.jsm
--- a/toolkit/components/telemetry/TelemetrySession.jsm
+++ b/toolkit/components/telemetry/TelemetrySession.jsm
@@ -1969,17 +1969,23 @@ var Impl = {
       Telemetry.flushBatchedChildTelemetry();
       this.sendContentProcessPing(REASON_SAVED_SESSION);
       break;
     case TOPIC_CYCLE_COLLECTOR_BEGIN:
       let now = new Date();
       if (!gLastMemoryPoll
           || (TELEMETRY_INTERVAL <= now - gLastMemoryPoll)) {
         gLastMemoryPoll = now;
-        this.gatherMemory();
+
+        this._log.trace("Dispatching idle gatherMemory task");
+        Services.tm.mainThread.idleDispatch(() => {
+          this._log.trace("Running idle gatherMemory task");
+          this.gatherMemory();
+          return true;
+        });
       }
       break;
     case "xul-window-visible":
       this.removeObserver("xul-window-visible");
       var counters = processInfo.getCounters();
       if (counters) {
         [this._startupIO.startupWindowVisibleReadBytes,
           this._startupIO.startupWindowVisibleWriteBytes] = counters;