Bug 1056954 - Normalize pid values when diffing. r=njn
authorEric Rahm <erahm@mozilla.com>
Fri, 22 Aug 2014 15:45:44 -0700
changeset 201278 ebeaf707ed6bd503b2331d8f4be3049fe0e96174
parent 201277 cf7967ad3bb8af1508259acc6d0dbf5e7f2d245f
child 201279 78fc4d778b8f37871543ea43bdf1bdad315ca0c6
push id27366
push userryanvm@gmail.com
push dateMon, 25 Aug 2014 15:49:45 +0000
treeherdermozilla-central@4ca2bd0722d9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnjn
bugs1056954
milestone34.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 1056954 - Normalize pid values when diffing. r=njn
toolkit/components/aboutmemory/content/aboutMemory.js
toolkit/components/aboutmemory/tests/memory-reports-diff1.json
toolkit/components/aboutmemory/tests/memory-reports-diff2.json
toolkit/components/aboutmemory/tests/test_aboutmemory3.xul
--- a/toolkit/components/aboutmemory/content/aboutMemory.js
+++ b/toolkit/components/aboutmemory/content/aboutMemory.js
@@ -818,18 +818,21 @@ function makeDReportMap(aJSONReports)
     assert(jr.units       !== undefined, "Missing units");
     assert(jr.amount      !== undefined, "Missing amount");
     assert(jr.description !== undefined, "Missing description");
 
     // Strip out some non-deterministic stuff that prevents clean diffs --
     // e.g. PIDs, addresses, null principal UUIDs. (Note that we don't strip
     // out all UUIDs because some of them -- such as those used by add-ons --
     // are deterministic.)
-    let strippedProcess = jr.process.replace(/pid \d+/g, "pid NNN");
+    let pidRegex = /pid([ =])\d+/g;
+    let pidSubst = "pid$1NNN";
+    let strippedProcess = jr.process.replace(pidRegex, pidSubst);
     let strippedPath = jr.path.replace(/0x[0-9A-Fa-f]+/g, "0xNNN");
+    strippedPath = strippedPath.replace(pidRegex, pidSubst);
     strippedPath = strippedPath.replace(
       /moz-nullprincipal:{........-....-....-....-............}/g,
       "moz-nullprincipal:{NNNNNNNN-NNNN-NNNN-NNNN-NNNNNNNNNNNN}");
     let processPath = strippedProcess + kProcessPathSep + strippedPath;
 
     let rOld = dreportMap[processPath];
     if (rOld === undefined) {
       dreportMap[processPath] =
--- a/toolkit/components/aboutmemory/tests/memory-reports-diff1.json
+++ b/toolkit/components/aboutmemory/tests/memory-reports-diff1.json
@@ -15,17 +15,17 @@
 
     {"process": "P", "path": "a/b", "kind": 2, "units": 0, "amount": 1000000, "description": "Desc."},
     {"process": "P", "path": "a/c/d", "kind": 2, "units": 0, "amount": 2000000, "description": "Desc."},
     {"process": "P", "path": "a/c/e", "kind": 2, "units": 0, "amount": 2000000, "description": "Desc."},
     {"process": "P", "path": "a/c/f", "kind": 2, "units": 0, "amount": 3000000, "description": "Desc."},
     {"process": "P", "path": "a/c/g", "kind": 2, "units": 0, "amount": 3000000, "description": "Desc."},
     {"process": "P", "path": "a/h", "kind": 2, "units": 0, "amount": 1000, "description": "Desc."},
 
-    {"process": "P2 (pid 22)", "path": "z-moz-nullprincipal:{85e250f3-57ae-46c4-a11e-4176dd39d9c5} 0x1234-blah(0x2345)", "kind": 2, "units": 0, "amount": 33, "description": "Desc."},
+    {"process": "P2 (pid 22)", "path": "z-moz-nullprincipal:{85e250f3-57ae-46c4-a11e-4176dd39d9c5} 0x1234-blah(0x2345) pid 123 pid=45678", "kind": 2, "units": 0, "amount": 33, "description": "Desc."},
 
     {"process": "P3", "path": "p3", "kind": 2, "units": 0, "amount": 55, "description": "Desc."},
 
     {"process": "P5", "path": "p5", "kind": 2, "units": 0, "amount": 0, "description": "Desc."},
 
     {"process": "P7", "path": "p7", "kind": 2, "units": 0, "amount": 5, "description": "Desc."},
 
     {"process": "P8", "path": "p8/a/b/c/d", "kind": 2, "units": 0, "amount": 3, "description": "Desc."},
--- a/toolkit/components/aboutmemory/tests/memory-reports-diff2.json
+++ b/toolkit/components/aboutmemory/tests/memory-reports-diff2.json
@@ -16,17 +16,17 @@
 
     {"process": "P", "path": "a/b", "kind": 2, "units": 0, "amount": 2000000, "description": "Desc."},
     {"process": "P", "path": "a/c/d", "kind": 2, "units": 0, "amount": 2998000, "description": "Desc."},
     {"process": "P", "path": "a/c/e", "kind": 2, "units": 0, "amount": 1001000, "description": "Desc."},
     {"process": "P", "path": "a/c/f", "kind": 2, "units": 0, "amount": 3001000, "description": "Desc."},
     {"process": "P", "path": "a/c/g", "kind": 2, "units": 0, "amount": 3001000, "description": "Desc."},
     {"process": "P", "path": "a/h", "kind": 2, "units": 0, "amount": 2000, "description": "Desc."},
 
-    {"process": "P2 (pid 33)", "path": "z-moz-nullprincipal:{161effaa-c1f7-4010-a08e-e7c9aea01aed} 0x5678-blah(0x6789)", "kind": 2, "units": 0, "amount": 44, "description": "Desc."},
+    {"process": "P2 (pid 33)", "path": "z-moz-nullprincipal:{161effaa-c1f7-4010-a08e-e7c9aea01aed} 0x5678-blah(0x6789) pid 456 pid=7890", "kind": 2, "units": 0, "amount": 44, "description": "Desc."},
 
     {"process": "P4", "path": "p4", "kind": 2, "units": 0, "amount": 66, "description": "Desc."},
 
     {"process": "P6", "path": "p6", "kind": 2, "units": 0, "amount": 0, "description": "Desc."},
 
     {"process": "P7", "path": "p7/b", "kind": 2, "units": 0, "amount": 3, "description": "Desc."},
     {"process": "P7", "path": "p7/c", "kind": 2, "units": 0, "amount": 4, "description": "Desc."},
 
--- a/toolkit/components/aboutmemory/tests/test_aboutmemory3.xul
+++ b/toolkit/components/aboutmemory/tests/test_aboutmemory3.xul
@@ -302,17 +302,17 @@ 0.96 MB (100.0%) -- a\n\
 \n\
  0.00 MB ── canvas-2d-pixel-bytes [2] [+]\n\
 -0.00 MB ── foobar [-]\n\
 \n\
 End of P\n\
 P2 (pid NNN)\n\
 Other Measurements\n\
 \n\
-0.00 MB ── z-moz-nullprincipal:{NNNNNNNN-NNNN-NNNN-NNNN-NNNNNNNNNNNN} 0xNNN-blah(0xNNN)\n\
+0.00 MB ── z-moz-nullprincipal:{NNNNNNNN-NNNN-NNNN-NNNN-NNNNNNNNNNNN} 0xNNN-blah(0xNNN) pid NNN pid=NNN\n\
 \n\
 End of P2 (pid NNN)\n\
 P3\n\
 Other Measurements\n\
 \n\
 -0.00 MB ── p3 [-]\n\
 \n\
 End of P3\n\
@@ -377,17 +377,17 @@ 1,002,000 B (100.0%) -- a\n\
 \n\
 3,000 B ── canvas-2d-pixel-bytes [2] [+]\n\
  -100 B ── foobar [-]\n\
 \n\
 End of P\n\
 P2 (pid NNN)\n\
 Other Measurements\n\
 \n\
-11 B ── z-moz-nullprincipal:{NNNNNNNN-NNNN-NNNN-NNNN-NNNNNNNNNNNN} 0xNNN-blah(0xNNN)\n\
+11 B ── z-moz-nullprincipal:{NNNNNNNN-NNNN-NNNN-NNNN-NNNNNNNNNNNN} 0xNNN-blah(0xNNN) pid NNN pid=NNN\n\
 \n\
 End of P2 (pid NNN)\n\
 P3\n\
 Other Measurements\n\
 \n\
 -55 B ── p3 [-]\n\
 \n\
 End of P3\n\