Bug 1191327 - Recapitulates alerts in about:performance now. r=felipe
authorDavid Rajchenbach-Teller <dteller@mozilla.com>
Wed, 05 Aug 2015 18:59:10 +0200
changeset 256657 55b6658ae0db54a3791f1544abe88016c1d5b6ab
parent 256656 7984b02e12a243b4880b8a6147dce8ed7372681c
child 256658 f48f05a347fcfe62d28917896c905eb98c2112a9
push id29186
push usercbook@mozilla.com
push dateFri, 07 Aug 2015 09:53:22 +0000
treeherdermozilla-central@91de9c670800 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfelipe
bugs1191327
milestone42.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 1191327 - Recapitulates alerts in about:performance now. r=felipe
toolkit/components/aboutperformance/content/aboutPerformance.js
--- a/toolkit/components/aboutperformance/content/aboutPerformance.js
+++ b/toolkit/components/aboutperformance/content/aboutPerformance.js
@@ -424,42 +424,57 @@ let View = {
    * be displayed in the order of `subset`.
    * @param {string} id The id of the DOM element that will contain the items.
    * @param {string} nature The nature of the subset. One of "addons", "webpages" or "system".
    * @param {string} currentMode The current display mode. One of MODE_GLOBAL or MODE_RECENT.
    */
   updateCategory: function(subset, id, nature, deltaT, currentMode) {
     subset = subset.slice().sort(Delta.revCompare);
 
+    let watcherAlerts = null;
+    if (nature == "addons") {
+      watcherAlerts = AddonWatcher.alerts;
+    }
+
     // Grab everything from the DOM before cleaning up
     let eltContainer = this._setupStructure(id);
 
     // An array of `cachedElements` that need to be added
     let toAdd = [];
     for (let delta of subset) {
       let cachedElements = this._grabOrCreateElements(delta, nature);
       toAdd.push(cachedElements);
       cachedElements.eltTitle.textContent = delta.readableName;
       cachedElements.eltName.textContent = `Full name: ${delta.fullName}.`;
       cachedElements.eltLoaded.textContent = `Measure start: ${Math.round(delta.age/1000)} seconds ago.`
       cachedElements.eltProcess.textContent = `Process: ${delta.processId} (${delta.isChildProcess?"child":"parent"}).`;
+      let jankSuffix = "";
+      let cpowSuffix = "";
+      if (watcherAlerts) {
+        let deltaAlerts = watcherAlerts.get(delta.addonId);
+        if (deltaAlerts) {
+          jankSuffix = ` (${deltaAlerts.alerts.longestDuration} alerts)`;
+          cpowSuffix = ` (${deltaAlerts.alerts.totalCPOWTime} alerts)`;
+        }
+      }
+
       let eltImpact = cachedElements.eltImpact;
       if (currentMode == MODE_RECENT) {
         cachedElements.eltRoot.setAttribute("impact", delta.jank.longestDuration + 1);
         if (Delta.compare(delta, Delta.MAX_DELTA_FOR_GOOD_RECENT_PERFORMANCE) <= 0) {
           eltImpact.textContent = ` currently performs well.`;
         } else if (Delta.compare(delta, Delta.MAX_DELTA_FOR_AVERAGE_RECENT_PERFORMANCE)) {
           eltImpact.textContent = ` may currently be slowing down ${BRAND_NAME}.`;
         } else {
           eltImpact.textContent = ` is currently considerably slowing down ${BRAND_NAME}.`;
         }
-        cachedElements.eltFPS.textContent = `Impact on framerate: ${delta.jank.longestDuration + 1}/${delta.jank.durations.length}.`;
+        cachedElements.eltFPS.textContent = `Impact on framerate: ${delta.jank.longestDuration + 1}/${delta.jank.durations.length}${jankSuffix}.`;
         cachedElements.eltCPU.textContent = `CPU usage: ${Math.min(100, Math.ceil(delta.jank.totalUserTime/deltaT))}%.`;
         cachedElements.eltSystem.textContent = `System usage: ${Math.min(100, Math.ceil(delta.jank.totalSystemTime/deltaT))}%.`;
-        cachedElements.eltCPOW.textContent = `Blocking process calls: ${Math.ceil(delta.cpow.totalCPOWTime/deltaT)}%.`;
+        cachedElements.eltCPOW.textContent = `Blocking process calls: ${Math.ceil(delta.cpow.totalCPOWTime/deltaT)}%${cpowSuffix}.`;
       } else {
         if (delta.alerts.length == 0) {
           eltImpact.textContent = " has performed well so far.";
           cachedElements.eltFPS.textContent = `Impact on framerate: no impact.`;
         } else {
           let sum = /* medium impact */ delta.alerts[0] + /* high impact */ delta.alerts[1];
           let frequency = sum * 1000 / delta.age;
 
@@ -479,21 +494,21 @@ let View = {
             // At this stage, `sum != 0`
             if (delta.alerts[1] / sum > MIN_PROPORTION_FOR_MAJOR_IMPACT) {
               describeImpact = "When this happens, the slowdown is generally important."
             } else {
               describeImpact = "When this happens, the slowdown is generally noticeable."
             }
 
             eltImpact.textContent = ` ${describeFrequency} ${describeImpact}`;
-            cachedElements.eltFPS.textContent = `Impact on framerate: ${delta.alerts[1]} high-impacts, ${delta.alerts[0]} medium-impact.`;
+            cachedElements.eltFPS.textContent = `Impact on framerate: ${delta.alerts[1]} high-impacts, ${delta.alerts[0]} medium-impact${jankSuffix}.`;
           }
           cachedElements.eltCPU.textContent = `CPU usage: ${Math.min(100, Math.ceil(delta.jank.totalUserTime/delta.age))}% (total ${delta.jank.totalUserTime}ms).`;
           cachedElements.eltSystem.textContent = `System usage: ${Math.min(100, Math.ceil(delta.jank.totalSystemTime/delta.age))}% (total ${delta.jank.totalSystemTime}ms).`;
-          cachedElements.eltCPOW.textContent = `Blocking process calls: ${Math.ceil(delta.cpow.totalCPOWTime/delta.age)}% (total ${delta.cpow.totalCPOWTime}ms).`;
+          cachedElements.eltCPOW.textContent = `Blocking process calls: ${Math.ceil(delta.cpow.totalCPOWTime/delta.age)}% (total ${delta.cpow.totalCPOWTime}ms)${cpowSuffix}.`;
         }
       }
     }
     this._insertElements(toAdd, id);
   },
 
   _insertElements: function(elements, id) {
     let eltContainer = document.getElementById(id);
@@ -676,17 +691,17 @@ let View = {
 
       for (let [name, className] of [
         ["eltName", "name"],
         ["eltFPS", "fps"],
         ["eltCPU", "cpu"],
         ["eltSystem", "system"],
         ["eltCPOW", "cpow"],
         ["eltLoaded", "loaded"],
-        ["eltProcess", "process"]
+        ["eltProcess", "process"],
       ]) {
         let elt = document.createElement("li");
         elt.classList.add(className);
         eltDetails.appendChild(elt);
         cachedElements[name] = elt;
       }
     }