Bug 1380081 - Part 2: Remove ThreadHangStats from about:telemetry, r=chutten
authorMichael Layzell <michael@thelayzells.com>
Mon, 17 Jul 2017 16:37:39 -0400
changeset 374831 ef5984e08bc2638b882a6d8d22fe15df8bc35499
parent 374830 a806fdd3092f4d88b7e9d9f5527d13754a1b7f75
child 374832 3ae61f0ba108f8cd4cde4c2ad624df326cb4ed38
push id93781
push usermichael@thelayzells.com
push dateTue, 15 Aug 2017 20:37:28 +0000
treeherdermozilla-inbound@ebd9e87fae8d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerschutten
bugs1380081
milestone57.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 1380081 - Part 2: Remove ThreadHangStats from about:telemetry, r=chutten MozReview-Commit-ID: KTOSKobhNAJ
toolkit/content/aboutTelemetry.js
toolkit/content/aboutTelemetry.xhtml
toolkit/locales/en-US/chrome/global/aboutTelemetry.dtd
--- a/toolkit/content/aboutTelemetry.js
+++ b/toolkit/content/aboutTelemetry.js
@@ -1133,67 +1133,16 @@ var CapturedStacks = {
 
   renderCaptureHeader: function CaptureStacks_renderCaptureHeader(index, captures) {
     let key = captures[index][0];
     let cardinality = captures[index][2];
     StackRenderer.renderHeader("captured-stacks", [key, cardinality]);
   }
 };
 
-var ThreadHangStats = {
-
-  /**
-   * Renders raw thread hang stats data
-   */
-  render(aPayload) {
-    let div = document.getElementById("thread-hang-stats");
-    removeAllChildNodes(div);
-
-    let stats = aPayload.threadHangStats;
-    setHasData("thread-hang-stats-section", stats && (stats.length > 0));
-    if (!stats) {
-      return;
-    }
-
-    stats.forEach((thread) => {
-      div.appendChild(this.renderThread(thread));
-    });
-  },
-
-  /**
-   * Creates and fills data corresponding to a thread
-   */
-  renderThread(aThread) {
-    let div = document.createElement("div");
-
-    let title = document.createElement("h2");
-    title.textContent = aThread.name;
-    div.appendChild(title);
-
-    // Don't localize the histogram name, because the
-    // name is also used as the div element's ID
-    Histogram.render(div, aThread.name + "-Activity",
-                     aThread.activity, {exponential: true}, true);
-    aThread.hangs.forEach((hang, index) => {
-      let hangName = aThread.name + "-Hang-" + (index + 1);
-      let hangDiv = Histogram.render(
-        div, hangName, hang.histogram, {exponential: true}, true);
-      let stackDiv = document.createElement("div");
-      hang.stack.forEach((frame) => {
-        stackDiv.appendChild(document.createTextNode(frame));
-        // Leave an extra <br> at the end of the stack listing
-        stackDiv.appendChild(document.createElement("br"));
-      });
-      // Insert stack after the histogram title
-      hangDiv.insertBefore(stackDiv, hangDiv.childNodes[1]);
-    });
-    return div;
-  },
-};
-
 var Histogram = {
 
   hgramSamplesCaption: bundle.GetStringFromName("histogramSamples"),
 
   hgramAverageCaption: bundle.GetStringFromName("histogramAverage"),
 
   hgramSumCaption: bundle.GetStringFromName("histogramSum"),
 
@@ -1202,21 +1151,20 @@ var Histogram = {
   /**
    * Renders a single Telemetry histogram
    *
    * @param aParent Parent element
    * @param aName Histogram name
    * @param aHgram Histogram information
    * @param aOptions Object with render options
    *                 * exponential: bars follow logarithmic scale
-   * @param aIsBHR whether or not requires fixing the labels for TimeHistogram
    */
-  render: function Histogram_render(aParent, aName, aHgram, aOptions, aIsBHR) {
+  render: function Histogram_render(aParent, aName, aHgram, aOptions) {
     let options = aOptions || {};
-    let hgram = this.processHistogram(aHgram, aName, aIsBHR);
+    let hgram = this.processHistogram(aHgram, aName);
 
     let outerDiv = document.createElement("div");
     outerDiv.className = "histogram";
     outerDiv.id = aName;
 
     let divTitle = document.createElement("div");
     divTitle.className = "histogram-title";
     divTitle.appendChild(document.createTextNode(aName));
@@ -1247,17 +1195,17 @@ var Histogram = {
                                                  .copyString(this.histogramText);
     });
     outerDiv.appendChild(copyButton);
 
     aParent.appendChild(outerDiv);
     return outerDiv;
   },
 
-  processHistogram(aHgram, aName, aIsBHR) {
+  processHistogram(aHgram, aName) {
     const values = Object.keys(aHgram.values).map(k => aHgram.values[k]);
     if (!values.length) {
       // If we have no values collected for this histogram, just return
       // zero values so we still render it.
       return {
         values: [],
         pretty_average: 0,
         max: 0,
@@ -1265,40 +1213,18 @@ var Histogram = {
         sum: 0
       };
     }
 
     const sample_count = values.reduceRight((a, b) => a + b);
     const average = Math.round(aHgram.sum * 10 / sample_count) / 10;
     const max_value = Math.max(...values);
 
-    function labelFunc(k) {
-      // - BHR histograms are TimeHistograms: Exactly power-of-two buckets (from 0)
-      //   (buckets: [0..1], [2..3], [4..7], [8..15], ... note the 0..1 anomaly - same bucket)
-      // - TimeHistogram's JS representation adds a dummy (empty) "0" bucket, and
-      //   the rest of the buckets have the label as the upper value of the
-      //   bucket (non TimeHistograms have the lower value of the bucket as label).
-      //   So JS TimeHistograms bucket labels are: 0 (dummy), 1, 3, 7, 15, ...
-      // - see toolkit/components/telemetry/Telemetry.cpp
-      //   (CreateJSTimeHistogram, CreateJSThreadHangStats, CreateJSHangHistogram)
-      // - see toolkit/components/telemetry/ThreadHangStats.h
-      // Fix BHR labels to the "standard" format for about:telemetry as follows:
-      //   - The dummy 0 label+bucket will be filtered before arriving here
-      //   - If it's 1 -> manually correct it to 0 (the 0..1 anomaly)
-      //   - For the rest, set the label as the bottom value instead of the upper.
-      //   --> so we'll end with the following (non dummy) labels: 0, 2, 4, 8, 16, ...
-      if (!aIsBHR) {
-        return k;
-      }
-      return k == 1 ? 0 : (k + 1) / 2;
-    }
-
     const labelledValues = Object.keys(aHgram.values)
-                           .filter(label => !aIsBHR || Number(label) != 0) // remove dummy 0 label for BHR
-                           .map(k => [labelFunc(Number(k)), aHgram.values[k]]);
+                           .map(k => [Number(k), aHgram.values[k]]);
 
     let result = {
       values: labelledValues,
       pretty_average: average,
       max: max_value,
       sample_count,
       sum: aHgram.sum
     };
@@ -2401,17 +2327,14 @@ function displayRichPingData(ping, updat
   }
 
   // Show chrome hang stacks
   ChromeHangs.render(payload);
 
   // Show telemetry log.
   TelLog.render(payload);
 
-  // Show thread hang stats
-  ThreadHangStats.render(payload);
-
   // Show simple measurements
   SimpleMeasurements.render(payload);
 
 }
 
 window.addEventListener("load", onLoad);
--- a/toolkit/content/aboutTelemetry.xhtml
+++ b/toolkit/content/aboutTelemetry.xhtml
@@ -67,19 +67,16 @@
         <span class="category-name">&aboutTelemetry.telemetryLogSection;</span>
       </div>
       <div class="category" value="slow-sql-section">
         <span class="category-name">&aboutTelemetry.slowSqlSection;</span>
       </div>
       <div class="category" value="chrome-hangs-section">
         <span class="category-name">&aboutTelemetry.chromeHangsSection;</span>
       </div>
-      <div class="category" value="thread-hang-stats-section">
-        <span class="category-name">&aboutTelemetry.threadHangStatsSection;</span>
-      </div>
       <div class="category" value="late-writes-section">
         <span class="category-name">&aboutTelemetry.lateWritesSection;</span>
       </div>
       <div class="category" value="addon-details-section">
         <span class="category-name">&aboutTelemetry.addonDetailsSection;</span>
       </div>
       <div class="category" value="captured-stacks-section">
         <span class="category-name">&aboutTelemetry.capturedStacksSection;</span>
@@ -207,20 +204,16 @@
           <a id="chrome-hangs-hide-symbols" class="hidden" href="">&aboutTelemetry.hideStackSymbols;</a>
           <br/>
           <br/>
           <div id="chrome-hangs-data">
           </div>
         </div>
       </section>
 
-      <section id="thread-hang-stats-section">
-        <div id="thread-hang-stats" class="data"></div>
-      </section>
-
       <section id="late-writes-section">
         <div id="late-writes" class="data">
           <a id="late-writes-fetch-symbols" href="">&aboutTelemetry.fetchStackSymbols;</a>
           <a id="late-writes-hide-symbols" class="hidden" href="">&aboutTelemetry.hideStackSymbols;</a>
           <br/>
           <br/>
           <div id="late-writes-data">
           </div>
--- a/toolkit/locales/en-US/chrome/global/aboutTelemetry.dtd
+++ b/toolkit/locales/en-US/chrome/global/aboutTelemetry.dtd
@@ -79,20 +79,16 @@ Older
 <!ENTITY aboutTelemetry.slowSqlSection "
   Slow SQL Statements
 ">
 
 <!ENTITY aboutTelemetry.chromeHangsSection "
   Browser Hangs
 ">
 
-<!ENTITY aboutTelemetry.threadHangStatsSection "
-  Thread Hangs
-">
-
 <!ENTITY aboutTelemetry.capturedStacksSection "
   Captured Stacks
 ">
 
 <!ENTITY aboutTelemetry.scalarsSection "
   Scalars
 ">