| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script src="../../http/tests/inspector/inspector-test.js"></script> | 3 <script src="../../http/tests/inspector/inspector-test.js"></script> |
| 4 <script src="profiler-test.js"></script> | 4 <script src="profiler-test.js"></script> |
| 5 <script> | 5 <script> |
| 6 | 6 |
| 7 function test() | 7 function test() |
| 8 { | 8 { |
| 9 var nodes = 1000; | 9 var nodes = 1000; |
| 10 function buildTree(count) | 10 function buildTree(count) |
| 11 { | 11 { |
| 12 // Build a call tree of a chain form: foo1 -> foo2 -> foo3 -> ... | 12 // Build a call tree of a chain form: foo1 -> foo2 -> foo3 -> ... |
| 13 // This should give a O(n^2) nodes in bottom-up tree. | 13 // This should give a O(n^2) nodes in bottom-up tree. |
| 14 var node = null; | 14 var node = null; |
| 15 for (var i = count; i > 0; --i) { | 15 for (var i = count; i > 0; --i) { |
| 16 var child = node; | 16 var child = node; |
| 17 node = { | 17 node = { |
| 18 "functionName": "foo" + i, | 18 "callFrame": |
| 19 "scriptId": "0", | 19 { |
| 20 "url": "a.js", | 20 "functionName": "foo" + i, |
| 21 "lineNumber": i, | 21 "scriptId": "0", |
| 22 "url": "a.js", |
| 23 "lineNumber": i |
| 24 }, |
| 22 "hitCount": 10, | 25 "hitCount": 10, |
| 23 "callUID": 10000 + i, | 26 "callUID": 10000 + i, |
| 24 "children": [] | 27 "children": [] |
| 25 }; | 28 }; |
| 26 if (child) | 29 if (child) |
| 27 node.children.push(child); | 30 node.children.push(child); |
| 28 } | 31 } |
| 29 return node; | 32 return node; |
| 30 } | 33 } |
| 31 var profileAndExpectations = { | 34 var profileAndExpectations = { |
| 32 "title": "profile1", | 35 "title": "profile1", |
| 33 "target": function() { | 36 "target": function() { |
| 34 return WebInspector.targetManager.targets()[0]; | 37 return WebInspector.targetManager.targets()[0]; |
| 35 }, | 38 }, |
| 36 "_profile": { | 39 "_profile": { |
| 37 "head": { | 40 "head": { |
| 38 "functionName": "(root)", | 41 "callFrame": |
| 39 "scriptId": "0", | 42 { |
| 40 "url": "a.js", | 43 "functionName": "(root)", |
| 41 "lineNumber": 0, | 44 "scriptId": "0", |
| 45 "url": "a.js", |
| 46 "lineNumber": 0, |
| 47 }, |
| 42 "hitCount": 1, | 48 "hitCount": 1, |
| 43 "callUID": 1000, | 49 "callUID": 1000, |
| 44 "children": [ | 50 "children": [ |
| 45 { | 51 { |
| 46 "functionName": "(idle)", | 52 "callFrame": |
| 47 "scriptId": "0", | 53 { |
| 48 "url": "a.js", | 54 "functionName": "(idle)", |
| 49 "lineNumber": 1, | 55 "scriptId": "0", |
| 56 "url": "a.js", |
| 57 "lineNumber": 1 |
| 58 }, |
| 50 "hitCount": 2, | 59 "hitCount": 2, |
| 51 "callUID": 2, | 60 "callUID": 2, |
| 52 "children": [] | 61 "children": [] |
| 53 }, | 62 }, |
| 54 buildTree(nodes) | 63 buildTree(nodes) |
| 55 ] | 64 ] |
| 56 }, | 65 }, |
| 57 "idleTime": 0.002, | 66 "idleTime": 0.002, |
| 58 "startTime": 0, | 67 "startTime": 0, |
| 59 "endTime": nodes * 0.01 + 0.003 | 68 "endTime": nodes * 0.01 + 0.003 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 74 } | 83 } |
| 75 | 84 |
| 76 </script> | 85 </script> |
| 77 </head> | 86 </head> |
| 78 <body onload="runTest()"> | 87 <body onload="runTest()"> |
| 79 <p> | 88 <p> |
| 80 Tests that search works for large bottom-up view of CPU profile. | 89 Tests that search works for large bottom-up view of CPU profile. |
| 81 </p> | 90 </p> |
| 82 </body> | 91 </body> |
| 83 </html> | 92 </html> |
| OLD | NEW |