Bug 1405585 - Add telemetry to watch inspector delay between new-root event and full update. r=francois,jdescottes datareview=francois
☠☠ backed out by f076a61f4c51 ☠ ☠
authorAlexandre Poirot <poirot.alex@gmail.com>
Mon, 23 Oct 2017 11:04:52 -0700
changeset 388403 d2f7f0e9554d248a7c23a082faefedef6f84b023
parent 388402 a049959544f21a423615c3f476306bf2dd6a6b37
child 388404 e760609ee0bbc072e914e9fda5131863d75f172b
push id32750
push userarchaeopteryx@coole-files.de
push dateThu, 26 Oct 2017 21:56:27 +0000
treeherdermozilla-central@a6d7be4ac1e3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfrancois, jdescottes
bugs1405585
milestone58.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 1405585 - Add telemetry to watch inspector delay between new-root event and full update. r=francois,jdescottes datareview=francois MozReview-Commit-ID: 5cWcTxPvDKF
devtools/client/inspector/inspector.js
toolkit/components/telemetry/Histograms.json
--- a/devtools/client/inspector/inspector.js
+++ b/devtools/client/inspector/inspector.js
@@ -843,16 +843,19 @@ Inspector.prototype = {
       this.eyeDropperButton = null;
     }
   },
 
   /**
    * Reset the inspector on new root mutation.
    */
   onNewRoot: function () {
+    // Record new-root timing for telemetry
+    this._newRootStart = this.panelWin.performance.now();
+
     this._defaultNode = null;
     this.selection.setNodeFront(null);
     this._destroyMarkup();
     this.isDirty = false;
 
     let onNodeSelected = defaultNode => {
       // Cancel this promise resolution as a new one had
       // been queued up.
@@ -895,16 +898,28 @@ Inspector.prototype = {
 
     // Wait for full expand of the selected node in order to ensure
     // the markup view is fully emitted before firing 'reloaded'.
     // 'reloaded' is used to know when the panel is fully updated
     // after a page reload.
     yield onExpand;
 
     this.emit("reloaded");
+
+    // Record the time between new-root event and inspector fully loaded.
+    if (this._newRootStart) {
+      // Only log the timing when inspector is in foreground.
+      if (this.toolbox.currentToolId == "inspector") {
+        let delay = this.panelWin.performance.now() - this._newRootStart;
+        let telemetryKey = "DEVTOOLS_INSPECTOR_NEW_ROOT_TO_RELOAD_DELAY_MS";
+        let histogram = Services.telemetry.getHistogramById(telemetryKey);
+        histogram.add(delay);
+      }
+      delete this._newRootStart;
+    }
   }),
 
   _selectionCssSelector: null,
 
   /**
    * Set the currently selected node unique css selector.
    * Will store the current target url along with it to allow pre-selection at
    * reload
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -8441,16 +8441,26 @@
     "bug_numbers": [1405585],
     "expires_in_version": "62",
     "kind": "exponential",
     "high": 120000,
     "n_buckets": 100,
     "keyed": true,
     "description": "Time taken (in ms) to update DevTools panel when reloading a page. This is keyed by tool ID being currently opened [inspector, webconsole, jsdebugger, styleeditor, shadereditor, canvasdebugger, performance, memory, netmonitor, storage, webaudioeditor, scratchpad, dom]."
   },
+  "DEVTOOLS_INSPECTOR_NEW_ROOT_TO_RELOAD_DELAY_MS": {
+    "record_in_processes": ["main"],
+    "alert_emails": ["dev-developer-tools@lists.mozilla.org", "hkirschner@mozilla.com"],
+    "bug_numbers": [1405585],
+    "expires_in_version": "62",
+    "kind": "exponential",
+    "high": 120000,
+    "n_buckets": 100,
+    "description": "Time taken (in ms) to update the inspector during a page reload, starting from new-root event."
+  },
   "DEVTOOLS_DEBUGGER_DISPLAY_SOURCE_LOCAL_MS": {
     "record_in_processes": ["main", "content"],
     "expires_in_version": "never",
     "kind": "exponential",
     "high": 10000,
     "n_buckets": 1000,
     "description": "The time (in milliseconds) that it took to display a selected source to the user."
   },