| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 // Load source code files from <project root>/tools. | 28 // Load source code files from <project root>/tools. |
| 29 // Files: tools/consarray.js tools/profile.js tools/profile_view.js | 29 // Files: tools/consarray.js tools/profile.js tools/profile_view.js |
| 30 | 30 |
| 31 | 31 |
| 32 function createNode(name, time, opt_parent) { | 32 function createNode(name, time, opt_parent) { |
| 33 var node = new devtools.profiler.ProfileView.Node(name, time, time, null); | 33 var node = new ProfileView.Node(name, time, time, null); |
| 34 if (opt_parent) { | 34 if (opt_parent) { |
| 35 opt_parent.addChild(node); | 35 opt_parent.addChild(node); |
| 36 } | 36 } |
| 37 return node; | 37 return node; |
| 38 } | 38 } |
| 39 | 39 |
| 40 | 40 |
| 41 (function testSorting() { | 41 (function testSorting() { |
| 42 // | 42 // |
| 43 // Build a tree: | 43 // Build a tree: |
| (...skipping 10 matching lines...) Expand all Loading... |
| 54 createNode('a', 2, root); | 54 createNode('a', 2, root); |
| 55 var a1 = createNode('a', 1, root); | 55 var a1 = createNode('a', 1, root); |
| 56 createNode('c', 1, root); | 56 createNode('c', 1, root); |
| 57 var b3 = createNode('b', 3, a1); | 57 var b3 = createNode('b', 3, a1); |
| 58 createNode('c', 1, a1); | 58 createNode('c', 1, a1); |
| 59 createNode('b', 2, a1); | 59 createNode('b', 2, a1); |
| 60 createNode('c', 5, b3); | 60 createNode('c', 5, b3); |
| 61 createNode('d', 4, b3); | 61 createNode('d', 4, b3); |
| 62 createNode('d', 2, b3); | 62 createNode('d', 2, b3); |
| 63 | 63 |
| 64 var view = new devtools.profiler.ProfileView(root); | 64 var view = new ProfileView(root); |
| 65 var flatTree = []; | 65 var flatTree = []; |
| 66 | 66 |
| 67 function fillFlatTree(node) { | 67 function fillFlatTree(node) { |
| 68 flatTree.push(node.internalFuncName); | 68 flatTree.push(node.internalFuncName); |
| 69 flatTree.push(node.selfTime); | 69 flatTree.push(node.selfTime); |
| 70 } | 70 } |
| 71 | 71 |
| 72 view.traverse(fillFlatTree); | 72 view.traverse(fillFlatTree); |
| 73 assertEquals( | 73 assertEquals( |
| 74 ['root', 0, | 74 ['root', 0, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 86 }); | 86 }); |
| 87 | 87 |
| 88 flatTree = []; | 88 flatTree = []; |
| 89 view.traverse(fillFlatTree); | 89 view.traverse(fillFlatTree); |
| 90 assertEquals( | 90 assertEquals( |
| 91 ['root', 0, | 91 ['root', 0, |
| 92 'a', 1, 'a', 2, 'c', 1, | 92 'a', 1, 'a', 2, 'c', 1, |
| 93 'b', 2, 'b', 3, 'c', 1, | 93 'b', 2, 'b', 3, 'c', 1, |
| 94 'c', 5, 'd', 2, 'd', 4], flatTree); | 94 'c', 5, 'd', 2, 'd', 4], flatTree); |
| 95 })(); | 95 })(); |
| OLD | NEW |