Bug 1476371 - Normalize thread names in about:memory diffs. r=njn

This normalizes thread IDs (tid) to use the form 'tid=NNN'. It also
normalizes threadpool numbers, for example 'Foo #1 (tid=1234)' is
mapped to 'Foo #N (tid=NNN)'.

--HG--
extra : rebase_source : a476da4dd81a1a34ae12170da1008a98005adf62
This commit is contained in:
Eric Rahm 2018-10-30 17:17:15 -07:00
parent 358ef761e3
commit 5817ebf336
4 changed files with 35 additions and 2 deletions

View File

@ -793,6 +793,10 @@ function makeDReportMap(aJSONReports) {
let process = jr.process.replace(pidRegex, pidSubst);
let path = jr.path.replace(pidRegex, pidSubst);
// Strip TIDs and threadpool IDs.
path = path.replace(/\(tid=(\d+)\)/, "(tid=NNN)")
path = path.replace(/#\d+ \(tid=NNN\)/, "#N (tid=NNN)")
// Strip addresses:
// - .../js-zone(0x12345678)/...
// - .../zone(0x12345678)/...

View File

@ -40,7 +40,10 @@
{"process": "P8", "path": "p8/a/b/c/e", "kind": 2, "units": 0, "amount": 4, "description": "Desc."},
{"process": "P8", "path": "p8/a/b/f", "kind": 2, "units": 0, "amount": 5, "description": "Desc."},
{"process": "P8", "path": "p8/a/g/h", "kind": 2, "units": 0, "amount": 6, "description": "Desc."},
{"process": "P8", "path": "p8/a/g/i", "kind": 2, "units": 0, "amount": 7, "description": "Desc."}
{"process": "P8", "path": "p8/a/g/i", "kind": 2, "units": 0, "amount": 7, "description": "Desc."},
{"process": "P9", "path": "explicit/threads/stacks/DNS Resolver #1 (tid=11)", "kind": 0, "units": 0, "amount": 2000, "description": "Desc."},
{"process": "P9", "path": "explicit/threads/stacks/DNS Resolver #2 (tid=22)", "kind": 0, "units": 0, "amount": 4000, "description": "Desc."}
]
}

View File

@ -39,7 +39,11 @@
{"process": "P7", "path": "p7/c", "kind": 2, "units": 0, "amount": 4, "description": "Desc."},
{"process": "P8", "path": "p8/a/b", "kind": 2, "units": 0, "amount": 1, "description": "Desc."},
{"process": "P8", "path": "p8/a/g", "kind": 2, "units": 0, "amount": 2, "description": "Desc."}
{"process": "P8", "path": "p8/a/g", "kind": 2, "units": 0, "amount": 2, "description": "Desc."},
{"process": "P9", "path": "explicit/threads/stacks/DNS Resolver #1 (tid=33)", "kind": 0, "units": 0, "amount": 2000, "description": "Desc."},
{"process": "P9", "path": "explicit/threads/stacks/DNS Resolver #2 (tid=44)", "kind": 0, "units": 0, "amount": 4000, "description": "Desc."},
{"process": "P9", "path": "explicit/threads/stacks/DNS Resolver #3 (tid=45)", "kind": 0, "units": 0, "amount": 5000, "description": "Desc."}
]
}

View File

@ -370,6 +370,17 @@ Other Measurements\n\
└───0.00 MB (-09.09%) ── (fake child) [!]\n\
\n\
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.
@ -468,6 +479,17 @@ Other Measurements\n\
└────2 B (-09.09%) ── (fake child) [!]\n\
\n\
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.