",
OTHER, 666 * MB),
f("2nd", "other1", OTHER, 111 * MB),
// kUnknown should be handled gracefully for "heap-allocated", non-leaf
// reporters, leaf-reporters, "other" reporters, and duplicated reporters.
f("3rd", "heap-allocated", OTHER, kUnknown),
f("3rd", "explicit/a", HEAP, kUnknown),
f("3rd", "explicit/a/b", HEAP, 333 * MB),
f("3rd", "explicit/a/c", HEAP, 444 * MB),
f("3rd", "explicit/a/c", HEAP, kUnknown), // dup: merge
f("3rd", "explicit/a/d", HEAP, kUnknown),
f("3rd", "explicit/a/d", HEAP, kUnknown), // dup: merge
f("3rd", "explicit/b", NONHEAP, kUnknown),
f("3rd", "other1", OTHER, kUnknown)
];
for (var i = 0; i < fakeReporters2.length; i++) {
mgr.registerReporter(fakeReporters2[i]);
}
fakeReporters = fakeReporters.concat(fakeReporters2);
]]>
\n\
1,000.00 MB -- heap-allocated\n\
100.00 MB -- heap-unallocated\n\
111.00 MB -- other1\n\
\n\
3rd Process\n\
\n\
Explicit Allocations\n\
777.00 MB (100.0%) -- explicit\n\
├──777.00 MB (100.0%) -- a [*]\n\
│ ├──444.00 MB (57.14%) -- c [2]\n\
│ ├──333.00 MB (42.86%) -- b\n\
│ └────0.00 MB (00.00%) -- (1 omitted)\n\
└────0.00 MB (00.00%) -- (2 omitted)\n\
\n\
Resident Set Size (RSS) Breakdown\n\
0.00 MB (100.0%) -- resident\n\
\n\
Virtual Size Breakdown\n\
0.00 MB (100.0%) -- vsize\n\
\n\
Swap Usage Breakdown\n\
0.00 MB (100.0%) -- swap\n\
\n\
Other Measurements\n\
0.00 MB -- heap-allocated [*]\n\
0.00 MB -- other1 [*]\n\
\n\
";
var amvExpectedText =
"\
Main Process\n\
\n\
Explicit Allocations\n\
653,876,224 B (100.0%) -- explicit\n\
├──243,269,632 B (37.20%) -- b\n\
│ ├───89,128,960 B (13.63%) -- a\n\
│ ├───78,643,200 B (12.03%) -- b\n\
│ └───75,497,472 B (11.55%) -- c\n\
│ ├──73,400,320 B (11.23%) -- a\n\
│ └───2,097,152 B (00.32%) -- b\n\
├──232,783,872 B (35.60%) -- a\n\
├──104,857,600 B (16.04%) -- c\n\
│ ├───80,740,352 B (12.35%) -- other\n\
│ └───24,117,248 B (03.69%) -- d [2]\n\
├───24,117,248 B (03.69%) -- cc [2]\n\
├───20,971,520 B (03.21%) -- f\n\
│ └──20,971,520 B (03.21%) -- g\n\
│ └──20,971,520 B (03.21%) -- h\n\
│ └──20,971,520 B (03.21%) -- i\n\
├───15,728,640 B (02.41%) -- g [2]\n\
│ ├───6,291,456 B (00.96%) -- a\n\
│ ├───5,242,880 B (00.80%) -- b\n\
│ └───4,194,304 B (00.64%) -- other\n\
├───11,534,336 B (01.76%) -- heap-unclassified\n\
├──────510,976 B (00.08%) -- d\n\
└──────102,400 B (00.02%) -- e\n\
\n\
Resident Set Size (RSS) Breakdown\n\
172,032 B (100.0%) -- resident\n\
└──172,032 B (100.0%) -- a\n\
\n\
Virtual Size Breakdown\n\
176,128 B (100.0%) -- vsize\n\
└──176,128 B (100.0%) -- a [2]\n\
\n\
Swap Usage Breakdown\n\
53,248 B (100.0%) -- swap\n\
├──40,960 B (76.92%) -- b\n\
│ └──40,960 B (76.92%) -- c\n\
└──12,288 B (23.08%) -- a [2]\n\
\n\
Other Measurements\n\
524,288,000 B -- heap-allocated\n\
104,857,600 B -- heap-unallocated\n\
116,391,936 B -- other1\n\
232,783,872 B -- other2\n\
777 -- other3\n\
888 -- other4\n\
45.67% -- perc1\n\
100.00% -- perc2\n\
\n\
2nd Process\n\
\n\
Explicit Allocations\n\
1,048,576,000 B (100.0%) -- explicit\n\
├────523,239,424 B (49.90%) -- a\n\
│ └──523,239,424 B (49.90%) -- b\n\
│ └──523,239,424 B (49.90%) -- c [3]\n\
├────209,715,200 B (20.00%) -- flip/the/backslashes\n\
├────209,715,200 B (20.00%) -- compartment(this-will-be-truncated-in-non-verbose-mode-abcdefghijklmnopqrstuvwxyz)\n\
└────105,906,176 B (10.10%) -- heap-unclassified\n\
\n\
Resident Set Size (RSS) Breakdown\n\
0 B (100.0%) -- resident\n\
\n\
Virtual Size Breakdown\n\
0 B (100.0%) -- vsize\n\
\n\
Swap Usage Breakdown\n\
0 B (100.0%) -- swap\n\
\n\
Other Measurements\n\
698,351,616 B -- danger\n\
1,048,576,000 B -- heap-allocated\n\
104,857,600 B -- heap-unallocated\n\
116,391,936 B -- other1\n\
\n\
3rd Process\n\
\n\
Explicit Allocations\n\
814,743,552 B (100.0%) -- explicit\n\
├──814,743,552 B (100.0%) -- a [*]\n\
│ ├──465,567,744 B (57.14%) -- c [2]\n\
│ ├──349,175,808 B (42.86%) -- b\n\
│ └────────────0 B (00.00%) -- d [*] [2]\n\
├────────────0 B (00.00%) -- b [*]\n\
└────────────0 B (00.00%) -- heap-unclassified [*]\n\
\n\
Resident Set Size (RSS) Breakdown\n\
0 B (100.0%) -- resident\n\
\n\
Virtual Size Breakdown\n\
0 B (100.0%) -- vsize\n\
\n\
Swap Usage Breakdown\n\
0 B (100.0%) -- swap\n\
\n\
Other Measurements\n\
0 B -- heap-allocated [*]\n\
0 B -- other1 [*]\n\
\n\
"
function finish()
{
// Unregister fake reporters and multi-reporters, re-register the real
// reporters and multi-reporters, just in case subsequent tests rely on
// them.
for (var i = 0; i < fakeReporters.length; i++) {
mgr.unregisterReporter(fakeReporters[i]);
}
for (var i = 0; i < fakeMultiReporters.length; i++) {
mgr.unregisterMultiReporter(fakeMultiReporters[i]);
}
for (var i = 0; i < realReporters.length; i++) {
mgr.registerReporter(realReporters[i]);
}
for (var i = 0; i < realMultiReporters.length; i++) {
mgr.registerMultiReporter(realMultiReporters[i]);
}
SimpleTest.finish();
}
function check(actual, expected) {
var a = actual.QueryInterface(Ci.nsISupportsString).data;
if (a != expected) {
dump("*******ACTUAL*******\n");
dump(a);
dump("******EXPECTED******\n");
dump(expected);
dump("********************\n");
return false;
}
return true;
}
// Cut+paste the entire page and check that the cut text matches what we
// expect. This tests the output in general and also that the cutting and
// pasting works as expected.
function test(aFrame, aExpectedText, aNext) {
// Click all h2.collapsed elements so they expand.
var win = document.querySelector("#" + aFrame).contentWindow;
var nodes = win.document.querySelectorAll("pre.collapsed");
for (var i = 0; i < nodes.length; i++) {
nodes[i].classList.toggle('collapsed');
}
SimpleTest.executeSoon(function() {
document.querySelector("#" + aFrame).focus();
SimpleTest.waitForClipboard(function(actual) { return check(actual, aExpectedText) },
function() {
synthesizeKey("A", {accelKey: true});
synthesizeKey("C", {accelKey: true});
},
aNext,
function() {
ok(false, "pasted text doesn't match for " + aFrame);
finish();
}
);
});
}
addLoadEvent(function() {
test(
"amFrame",
amExpectedText,
function() {
test(
"amvFrame",
amvExpectedText,
function() {
finish()
}
)
}
);
});
SimpleTest.waitForExplicitFinish();
]]>