Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Side by Side Diff: third_party/WebKit/LayoutTests/inspector/profiler/cpu-profiler-bottom-up-large-tree-search.html

Issue 2244783004: DevTools: Refactor Profiler domain interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 nodesCount = 1000;
10 function buildTree(count) 10 function buildTree(startId, 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 nodes = [];
15 for (var i = count; i > 0; --i) { 15 for (var i = 1; i <= count; ++i) {
16 var child = node; 16 nodes.push({
17 node = { 17 "id": startId + i - 1,
18 "callFrame": 18 "callFrame":
19 { 19 {
20 "functionName": "foo" + i, 20 "functionName": "foo" + i,
21 "scriptId": "0", 21 "scriptId": "0",
22 "url": "a.js", 22 "url": "a.js",
23 "lineNumber": i 23 "lineNumber": i
24 }, 24 },
25 "hitCount": 10, 25 "hitCount": 10,
26 "callUID": 10000 + i, 26 "children": i < count ? [startId + i] : []
27 "children": [] 27 });
28 };
29 if (child)
30 node.children.push(child);
31 } 28 }
32 return node; 29 return nodes;
33 } 30 }
34 var profileAndExpectations = { 31 var profileAndExpectations = {
35 "title": "profile1", 32 "title": "profile1",
36 "target": function() { 33 "target": function() {
37 return WebInspector.targetManager.targets()[0]; 34 return WebInspector.targetManager.targets()[0];
38 }, 35 },
39 "_profile": { 36 "_profile": {
40 "head": { 37 "nodes": [
41 "callFrame":
42 { 38 {
43 "functionName": "(root)", 39 "id": 0,
44 "scriptId": "0", 40 "callFrame":
45 "url": "a.js", 41 {
46 "lineNumber": 0, 42 "functionName": "(root)",
43 "scriptId": "0",
44 "url": "a.js",
45 "lineNumber": 0,
46 },
47 "hitCount": 1,
48 "children": [1,2]
47 }, 49 },
48 "hitCount": 1,
49 "callUID": 1000,
50 "children": [
51 { 50 {
51 "id": 1,
52 "callFrame": 52 "callFrame":
53 { 53 {
54 "functionName": "(idle)", 54 "functionName": "(idle)",
55 "scriptId": "0", 55 "scriptId": "0",
56 "url": "a.js", 56 "url": "a.js",
57 "lineNumber": 1 57 "lineNumber": 1
58 }, 58 },
59 "hitCount": 2, 59 "hitCount": 2,
60 "callUID": 2,
61 "children": [] 60 "children": []
62 }, 61 }
63 buildTree(nodes) 62 ].concat(buildTree(2, nodesCount)),
64 ]
65 },
66 "idleTime": 0.002, 63 "idleTime": 0.002,
67 "startTime": 0, 64 "startTime": 0,
68 "endTime": nodes * 0.01 + 0.003 65 "endTime": nodesCount * 0.01 + 0.003
69 } 66 }
70 }; 67 };
71 var view = new WebInspector.CPUProfileView(profileAndExpectations); 68 var view = new WebInspector.CPUProfileView(profileAndExpectations);
72 view.viewSelectComboBox.setSelectedIndex(1); 69 view.viewSelectComboBox.setSelectedIndex(1);
73 view._changeView(); 70 view._changeView();
74 var tree = view.profileDataGridTree; 71 var tree = view.profileDataGridTree;
75 if (!tree) 72 if (!tree)
76 InspectorTest.addResult("no tree"); 73 InspectorTest.addResult("no tree");
77 tree.performSearch(new WebInspector.SearchableView.SearchConfig("foo12", tru e, false), false); 74 tree.performSearch(new WebInspector.SearchableView.SearchConfig("foo12", tru e, false), false);
78 for (var item of tree._searchResults) { 75 for (var item of tree._searchResults) {
79 var node = item.profileNode; 76 var node = item.profileNode;
80 InspectorTest.addResult(`${node.callUID}: ${node.functionName} ${node.se lf} ${node.total}`); 77 InspectorTest.addResult(`${node.callUID}: ${node.functionName} ${node.se lf} ${node.total}`);
81 } 78 }
82 InspectorTest.completeProfilerTest(); 79 InspectorTest.completeProfilerTest();
83 } 80 }
84 81
85 </script> 82 </script>
86 </head> 83 </head>
87 <body onload="runTest()"> 84 <body onload="runTest()">
88 <p> 85 <p>
89 Tests that search works for large bottom-up view of CPU profile. 86 Tests that search works for large bottom-up view of CPU profile.
90 </p> 87 </p>
91 </body> 88 </body>
92 </html> 89 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698