Bug 1517175 - Part 1: Omit "Other Measurements" section when empty r=njn
authorCameron McCormack <cam@mcc.id.au>
Mon, 07 Jan 2019 03:04:44 +0000
changeset 509780 79dfd716ddeb583bf14d27281e4531d976db3d3f
parent 509771 029414a7448afe97b06f3f5a9c96ceaae93c44e3
child 509781 eb6cf8333a9aac70bddfa87b670dbce922fbe058
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnjn
bugs1517175
milestone66.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 1517175 - Part 1: Omit "Other Measurements" section when empty r=njn Differential Revision: https://phabricator.services.mozilla.com/D15628
toolkit/components/aboutmemory/content/aboutMemory.js
toolkit/components/aboutmemory/tests/test_aboutmemory3.xul
toolkit/components/aboutmemory/tests/test_aboutmemory4.xul
--- a/toolkit/components/aboutmemory/content/aboutMemory.js
+++ b/toolkit/components/aboutmemory/content/aboutMemory.js
@@ -1495,26 +1495,28 @@ function appendProcessAboutMemoryElement
     if (length > maxStringLength) {
       maxStringLength = length;
     }
     otherDegenerates.push(t);
   }
   otherDegenerates.sort(TreeNode.compareUnsafeNames);
 
   // Now generate the elements, putting non-degenerate trees first.
-  let pre = appendSectionHeader(aP, "Other Measurements");
-  for (let t of otherTrees) {
-    appendTreeElements(pre, t, aProcess, "");
-    appendTextNode(pre, "\n"); // blank lines after non-degenerate trees
+  if (otherTrees.length || otherDegenerates.length) {
+    let pre = appendSectionHeader(aP, "Other Measurements");
+    for (let t of otherTrees) {
+      appendTreeElements(pre, t, aProcess, "");
+      appendTextNode(pre, "\n"); // blank lines after non-degenerate trees
+    }
+    for (let t of otherDegenerates) {
+      let padText = "".padStart(maxStringLength - t.toString().length, " ");
+      appendTreeElements(pre, t, aProcess, padText);
+    }
+    appendTextNode(aP, "\n"); // gives nice spacing when we copy and paste
   }
-  for (let t of otherDegenerates) {
-    let padText = "".padStart(maxStringLength - t.toString().length, " ");
-    appendTreeElements(pre, t, aProcess, padText);
-  }
-  appendTextNode(aP, "\n"); // gives nice spacing when we copy and paste
 
   // Add any warnings about inaccuracies in the "explicit" tree due to platform
   // limitations.  These must be computed after generating all the text.  The
   // newlines give nice spacing if we copy+paste into a text buffer.
   if (hasExplicitTree) {
     appendWarningElements(warningsDiv, hasKnownHeapAllocated,
                           aHasMozMallocUsableSize);
   }
--- a/toolkit/components/aboutmemory/tests/test_aboutmemory3.xul
+++ b/toolkit/components/aboutmemory/tests/test_aboutmemory3.xul
@@ -184,18 +184,16 @@
 Explicit-only process\n\
 \n\
 WARNING: the 'heap-allocated' memory reporter does not work for this platform and/or configuration. This means that 'heap-unclassified' is not shown and the 'explicit' tree shows less memory than it should.\n\
 Explicit Allocations\n\
 \n\
 100,000 B (100.0%) -- explicit\n\
 └──100,000 B (100.0%) ── a/b\n\
 \n\
-Other Measurements\n\
-\n\
 End of Explicit-only process\n\
 Heap-unclassified process\n\
 Explicit Allocations\n\
 \n\
 262,144,000 B (100.0%) -- explicit\n\
 ├──209,715,200 B (80.00%) ── heap-unclassified\n\
 └───52,428,800 B (20.00%) ── a/b\n\
 \n\
@@ -373,18 +371,16 @@ End of P8\n\
 P9\n\
 \n\
 WARNING: the 'heap-allocated' memory reporter does not work for this platform and/or configuration. This means that 'heap-unclassified' is not shown and the 'explicit' tree shows less memory than it should.\n\
 Explicit Allocations\n\
 \n\
 0.00 MB (100.0%) -- explicit\n\
 └──0.00 MB (100.0%) ── threads/stacks/DNS Resolver #N (tid=NNN) [3]\n\
 \n\
-Other Measurements\n\
-\n\
 End of P9\n\
 ";
 
   // This is the output for a verbose diff.
   let expectedDiffVerbose =
 "\
 P\n\
 \n\
@@ -482,18 +478,16 @@ End of P8\n\
 P9\n\
 \n\
 WARNING: the 'heap-allocated' memory reporter does not work for this platform and/or configuration. This means that 'heap-unclassified' is not shown and the 'explicit' tree shows less memory than it should.\n\
 Explicit Allocations\n\
 \n\
 5,000 B (100.0%) -- explicit\n\
 └──5,000 B (100.0%) ── threads/stacks/DNS Resolver #N (tid=NNN) [3]\n\
 \n\
-Other Measurements\n\
-\n\
 End of P9\n\
 ";
 
   // This is the output for the crash reports diff.
   let expectedDiff2 =
 "\
 Main Process (pid NNN)\n\
 Other Measurements\n\
--- a/toolkit/components/aboutmemory/tests/test_aboutmemory4.xul
+++ b/toolkit/components/aboutmemory/tests/test_aboutmemory4.xul
@@ -95,18 +95,16 @@
 Explicit-only process\n\
 \n\
 WARNING: the 'heap-allocated' memory reporter does not work for this platform and/or configuration. This means that 'heap-unclassified' is not shown and the 'explicit' tree shows less memory than it should.\n\
 Explicit Allocations\n\
 \n\
 0.10 MB (100.0%) -- explicit\n\
 └──0.10 MB (100.0%) ── a/b\n\
 \n\
-Other Measurements\n\
-\n\
 End of Explicit-only process\n\
 Heap-unclassified process\n\
 Explicit Allocations\n\
 \n\
 250.00 MB (100.0%) -- explicit\n\
 ├──200.00 MB (80.00%) ── heap-unclassified\n\
 └───50.00 MB (20.00%) ── a/b\n\
 \n\