diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
commit | 2aa4a82499d4becd2284cdb482213d541b8804dd (patch) | |
tree | b80bf8bf13c3766139fbacc530efd0dd9d54394c /devtools/client/performance/test/xpcshell/test_tree-model-12.js | |
parent | Initial commit. (diff) | |
download | firefox-upstream.tar.xz firefox-upstream.zip |
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'devtools/client/performance/test/xpcshell/test_tree-model-12.js')
-rw-r--r-- | devtools/client/performance/test/xpcshell/test_tree-model-12.js | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/devtools/client/performance/test/xpcshell/test_tree-model-12.js b/devtools/client/performance/test/xpcshell/test_tree-model-12.js new file mode 100644 index 0000000000..9576970784 --- /dev/null +++ b/devtools/client/performance/test/xpcshell/test_tree-model-12.js @@ -0,0 +1,103 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; + +// Test that uninverting the call tree works correctly when there are stacks +// in the profile that prefixes of other stacks. + +add_task(function() { + const { + ThreadNode, + } = require("devtools/client/performance/modules/logic/tree-model"); + const thread = new ThreadNode(gThread, { startTime: 0, endTime: 50 }); + const root = getFrameNodePath(thread, "(root)"); + + /** + * Samples + * + * A->B + * C->B + * B + * A + * Z->Y->X + * W->Y->X + * Y->X + */ + + equal( + getFrameNodePath(root, "A > B").youngestFrameSamples, + 1, + "A > B has the correct self count" + ); + equal( + getFrameNodePath(root, "C > B").youngestFrameSamples, + 1, + "C > B has the correct self count" + ); + equal( + getFrameNodePath(root, "B").youngestFrameSamples, + 1, + "B has the correct self count" + ); + equal( + getFrameNodePath(root, "A").youngestFrameSamples, + 1, + "A has the correct self count" + ); + equal( + getFrameNodePath(root, "Z > Y > X").youngestFrameSamples, + 1, + "Z > Y > X has the correct self count" + ); + equal( + getFrameNodePath(root, "W > Y > X").youngestFrameSamples, + 1, + "W > Y > X has the correct self count" + ); + equal( + getFrameNodePath(root, "Y > X").youngestFrameSamples, + 1, + "Y > X has the correct self count" + ); +}); + +var gThread = synthesizeProfileForTest([ + { + time: 5, + frames: [{ location: "(root)" }, { location: "A" }, { location: "B" }], + }, + { + time: 10, + frames: [{ location: "(root)" }, { location: "C" }, { location: "B" }], + }, + { + time: 15, + frames: [{ location: "(root)" }, { location: "B" }], + }, + { + time: 20, + frames: [{ location: "(root)" }, { location: "A" }], + }, + { + time: 21, + frames: [ + { location: "(root)" }, + { location: "Z" }, + { location: "Y" }, + { location: "X" }, + ], + }, + { + time: 22, + frames: [ + { location: "(root)" }, + { location: "W" }, + { location: "Y" }, + { location: "X" }, + ], + }, + { + time: 23, + frames: [{ location: "(root)" }, { location: "Y" }, { location: "X" }], + }, +]); |