Bug 972797 - More telemetry on SessionStore data collection. r=ttaubert
☠☠ backed out by 1a023bc837da ☠ ☠
authorDavid Rajchenbach-Teller <dteller@mozilla.com>
Tue, 18 Feb 2014 09:20:26 -0500
changeset 169700 6ea78f586fdcf27132ac33bdeeff87eea788d32c
parent 169699 f095cf2a41b2470e23705524568616b175a9e8ab
child 169701 5f87786ceab5a4aa3f8a6791a17b7b856929c756
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewersttaubert
bugs972797
milestone30.0a1
Bug 972797 - More telemetry on SessionStore data collection. r=ttaubert
browser/components/sessionstore/src/SessionStore.jsm
toolkit/components/telemetry/Histograms.json
--- a/browser/components/sessionstore/src/SessionStore.jsm
+++ b/browser/components/sessionstore/src/SessionStore.jsm
@@ -2006,30 +2006,32 @@ let SessionStoreInternal = {
    *        Bool update all windows
    * @returns object
    */
   getCurrentState: function (aUpdateAll) {
     this._handleClosedWindows();
 
     var activeWindow = this._getMostRecentBrowserWindow();
 
+    TelemetryStopwatch.start("FX_SESSION_RESTORE_COLLECT_ALL_WINDOWS_DATA_MS");
     if (this._loadState == STATE_RUNNING) {
       // update the data for all windows with activities since the last save operation
       this._forEachBrowserWindow(function(aWindow) {
         if (!this._isWindowLoaded(aWindow)) // window data is still in _statesToRestore
           return;
         if (aUpdateAll || DirtyWindows.has(aWindow) || aWindow == activeWindow) {
           this._collectWindowData(aWindow);
         }
         else { // always update the window features (whose change alone never triggers a save operation)
           this._updateWindowFeatures(aWindow);
         }
       });
       DirtyWindows.clear();
     }
+    TelemetryStopwatch.stop("FX_SESSION_RESTORE_COLLECT_ALL_WINDOWS_DATA_MS");
 
     // An array that at the end will hold all current window data.
     var total = [];
     // The ids of all windows contained in 'total' in the same order.
     var ids = [];
     // The number of window that are _not_ popups.
     var nonPopupCount = 0;
     var ix;
@@ -2038,17 +2040,20 @@ let SessionStoreInternal = {
     for (ix in this._windows) {
       if (this._windows[ix]._restoring) // window data is still in _statesToRestore
         continue;
       total.push(this._windows[ix]);
       ids.push(ix);
       if (!this._windows[ix].isPopup)
         nonPopupCount++;
     }
+
+    TelemetryStopwatch.start("FX_SESSION_RESTORE_COLLECT_COOKIES_MS");
     SessionCookies.update(total);
+    TelemetryStopwatch.stop("FX_SESSION_RESTORE_COLLECT_COOKIES_MS");
 
     // collect the data for all windows yet to be restored
     for (ix in this._statesToRestore) {
       for each (let winData in this._statesToRestore[ix].windows) {
         total.push(winData);
         if (!winData.isPopup)
           nonPopupCount++;
       }
@@ -2084,17 +2089,17 @@ let SessionStoreInternal = {
 
     let session = {
       lastUpdate: Date.now(),
       startTime: this._sessionStartTime,
       recentCrashes: this._recentCrashes
     };
 
     // get open Scratchpad window states too
-    var scratchpads = ScratchpadManager.getSessionState();
+    let scratchpads = ScratchpadManager.getSessionState();
 
     let state = {
       windows: total,
       selectedWindow: ix + 1,
       _closedWindows: lastClosedWindowsCopy,
       session: session,
       scratchpads: scratchpads,
       global: this._globalState.getState()
@@ -2133,16 +2138,17 @@ let SessionStoreInternal = {
     SessionCookies.update(windows);
 
     return { windows: windows };
   },
 
   _collectWindowData: function ssi_collectWindowData(aWindow) {
     if (!this._isWindowLoaded(aWindow))
       return;
+    TelemetryStopwatch.start("FX_SESSION_RESTORE_COLLECT_SINGLE_WINDOW_DATA_MS");
 
     let tabbrowser = aWindow.gBrowser;
     let tabs = tabbrowser.tabs;
     let winData = this._windows[aWindow.__SSi];
     let tabsData = winData.tabs = [];
 
     // update the internal state data for this window
     for (let tab of tabs) {
@@ -2154,16 +2160,17 @@ let SessionStoreInternal = {
 
     // Make sure we keep __SS_lastSessionWindowID around for cases like entering
     // or leaving PB mode.
     if (aWindow.__SS_lastSessionWindowID)
       this._windows[aWindow.__SSi].__lastSessionWindowID =
         aWindow.__SS_lastSessionWindowID;
 
     DirtyWindows.remove(aWindow);
+    TelemetryStopwatch.stop("FX_SESSION_RESTORE_COLLECT_SINGLE_WINDOW_DATA_MS");
   },
 
   /* ........ Restoring Functionality .............. */
 
   /**
    * restore features to a single window
    * @param aWindow
    *        Window reference
--- a/toolkit/components/telemetry/Histograms.json
+++ b/toolkit/components/telemetry/Histograms.json
@@ -3288,16 +3288,40 @@
     "expires_in_version": "never",
     "kind": "exponential",
     "low": 50,
     "high": "60000",
     "n_buckets": 20,
     "extended_statistics_ok": true,
     "description": "Widget: Time it takes for the message before a UI message (ms)"
   },
+  "FX_SESSION_RESTORE_COLLECT_ALL_WINDOWS_DATA_MS": {
+    "expires_in_version": "never",
+    "kind": "exponential",
+    "high": "30000",
+    "n_buckets": 10,
+    "extended_statistics_ok": true,
+    "description": "Session restore: Time to collect all window data (ms)"
+  },
+  "FX_SESSION_RESTORE_COLLECT_SINGLE_WINDOW_DATA_MS": {
+    "expires_in_version": "never",
+    "kind": "exponential",
+    "high": "30000",
+    "n_buckets": 10,
+    "extended_statistics_ok": true,
+    "description": "Session restore: Time to collect the data of a single window (ms)"
+  },
+  "FX_SESSION_RESTORE_COLLECT_COOKIES_MS": {
+    "expires_in_version": "never",
+    "kind": "exponential",
+    "high": "30000",
+    "n_buckets": 10,
+    "extended_statistics_ok": true,
+    "description": "Session restore: Time to collect cookies (ms)"
+  },
   "FX_SESSION_RESTORE_COLLECT_DATA_MS": {
     "expires_in_version": "never",
     "kind": "exponential",
     "high": "30000",
     "n_buckets": 10,
     "extended_statistics_ok": true,
     "description": "Session restore: Time to collect all window and tab data (ms)"
   },