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

Side by Side Diff: LayoutTests/inspector/tracing/timeline-coalescing.html

Issue 477153005: DevTools: adopt existing Timeline tests for tracing based Timeline (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 <html>
2 <head>
3 <script src="../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../http/tests/inspector/timeline-test.js"></script>
5 <script>
6
7 function initialize_TimelineCoalescing()
8 {
9
10 InspectorTest.dumpStats = function(presentationRecord)
11 {
12 if (!presentationRecord.presentationParent())
13 return "";
14
15 var aggregatedStats = {};
16 var uiUtils = WebInspector.panels.timeline._uiUtils;
17 if (presentationRecord.coalesced()) {
18 var presentationChildren = presentationRecord.presentationChildren();
19 for (var i = 0; i < presentationChildren.length; ++i)
20 uiUtils.aggregateTimeForRecord(aggregatedStats, presentationChildren [i].record());
21 } else {
22 uiUtils.aggregateTimeForRecord(aggregatedStats, presentationRecord.recor d());
23 }
24
25 var timeByCategory = "";
26
27 for (category in aggregatedStats) {
28 if (timeByCategory)
29 timeByCategory += ", ";
30 timeByCategory += category + ": " + aggregatedStats[category].toFixed(5) ;
31 }
32 var duration = (presentationRecord.endTime() - presentationRecord.startTime( )).toFixed(5);
33 var durationTillLastChild = (presentationRecord.endTime() - presentationReco rd.startTime()).toFixed(5);
34 return "duration: " + duration + ":" + durationTillLastChild + (timeByCatego ry ? " (" + timeByCategory + ")" : "");
35 }
36
37 }
38
39 function test()
40 {
41 var sessionId = "4.20";
42 var mainThread = 1;
43 var pid = 100;
44
45 var testData = [
46 // Assure we coalesce records with short interval and don't coalesce rec ords that stand apart.
47 {
48 "args": { "sessionId": sessionId },
49 "cat": "disabled-by-default-devtools.timeline",
50 "name": "TracingStartedInPage",
51 "ph": "I",
52 "pid": pid,
53 "tid": mainThread,
54 "ts": 100,
55 },
56 {"name": "Program", "ts": 1000000, "ph": "B", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {}},
57 {"name": "FunctionCall", "ts": 1000000, "ph": "B", "tid": mainThread , "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args":{"data":{"fr ame":"0x2","scriptId":"3","scriptLine":5,"scriptName":"http://example.com"}}},
58 {"name": "Layout", "ts": 1000001, "ph": "B", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args":{"beginData":{ "dirtyObjects":1,"frame":"0x2","partialLayout":false,"totalObjects":1}} },
59 {"name": "CallStack", "ts": 1000002, "ph": "I", "tid": mainT hread, "pid": pid, "cat":"disabled-by-default.devtools.timeline.stack", "args":{
60 "stack":[
61 {"functionName":"func","url":"http://example.com","l ineNumber":42,"columnNumber":1,"scriptId":"10"}
62 ]}
63 },
64 {"name": "Layout", "ts": 1099900, "ph": "E", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args":{"endData":{"r oot":[0,0,1570,0,1570,243,0,243],"rootNode":1}}},
65
66 {"name": "Layout", "ts": 1100001, "ph": "B", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args":{"beginData":{ "dirtyObjects":1,"frame":"0x2","partialLayout":false,"totalObjects":1}} },
67 {"name": "Layout", "ts": 1199900, "ph": "E", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args":{"endData":{"r oot":[0,0,1570,0,1570,243,0,243],"rootNode":1}}},
68
69 {"name": "Layout", "ts": 1200001, "ph": "B", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args":{"beginData":{ "dirtyObjects":1,"frame":"0x2","partialLayout":false,"totalObjects":1}} },
70 {"name": "Layout", "ts": 1299900, "ph": "E", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args":{"endData":{"r oot":[0,0,1570,0,1570,243,0,243],"rootNode":1}}},
71 {"name": "FunctionCall", "ts": 1299998, "ph": "E", "tid": mainThread , "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {}},
72 {"name": "Program", "ts": 1299999, "ph": "E", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {}},
73
74 {"name": "Program", "ts": 1300000, "ph": "B", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {}},
75 {"name": "Layout", "ts": 1305001, "ph": "B", "tid": mainThread, "pid ": pid, "cat":"disabled-by-default.devtools.timeline", "args":{"beginData":{"dir tyObjects":1,"frame":"0x2","partialLayout":false,"totalObjects":1}} },
76 {"name": "Layout", "ts": 1399900, "ph": "E", "tid": mainThread, "pid ": pid, "cat":"disabled-by-default.devtools.timeline", "args":{"endData":{"root" :[0,0,1570,0,1570,243,0,243],"rootNode":1}}},
77 {"name": "Program", "ts": 1399999, "ph": "E", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {}},
78
79 // Assure we do coalesce on levels lower than root, but do not coalesce between different parents.
80 {"name": "Program", "ts": 2000000, "ph": "B", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {}},
81 {"name": "FunctionCall", "ts": 2000001, "ph": "B", "tid": mainThread , "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args":{"data":{"fr ame":"0x2","scriptId":"3","scriptLine":5,"scriptName":"http://example.com"}}},
82 {"name": "Decode Image", "ts": 2000002, "ph": "B", "tid": mainTh read, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args":{"imageT ype":"JPEG"}},
83 {"name": "Decode Image", "ts": 2099900, "ph": "E", "tid": mainTh read, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {}},
84 {"name": "Decode Image", "ts": 2100000, "ph": "B", "tid": mainTh read, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args":{"imageT ype":"JPEG"}},
85 {"name": "Decode Image", "ts": 2199900, "ph": "E", "tid": mainTh read, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {}},
86 {"name": "FunctionCall", "ts": 2199998, "ph": "E", "tid": mainThread , "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {}},
87 {"name": "FunctionCall", "ts": 2200001, "ph": "B", "tid": mainThread , "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args":{"data":{"fr ame":"0x2","scriptId":"3","scriptLine":5,"scriptName":"http://example.com"}}},
88 {"name": "Decode Image", "ts": 2200002, "ph": "B", "tid": mainTh read, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args":{"imageT ype":"JPEG"}},
89 {"name": "Decode Image", "ts": 2299900, "ph": "E", "tid": mainTh read, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {}},
90 {"name": "Decode Image", "ts": 2300000, "ph": "B", "tid": mainTh read, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args":{"imageT ype":"JPEG"}},
91 {"name": "Decode Image", "ts": 2399900, "ph": "E", "tid": mainTh read, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {}},
92 {"name": "FunctionCall", "ts": 2399998, "ph": "E", "tid": mainThread , "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {}},
93 {"name": "Program", "ts": 2399999, "ph": "E", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {}},
94
95 // Assure we only coalesce timestamp records with the same message.
96 {"name": "Program", "ts": 3100000, "ph": "B", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {}},
97 {"name": "RasterTask", "ts": 3100001, "ph": "B", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args":{"layerId":11} },
98 {"name": "RasterTask", "ts": 3199900, "ph": "E", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args":{}},
99 {"name": "Program", "ts": 3199999, "ph": "E", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {}},
100 {"name": "Program", "ts": 3200000, "ph": "B", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {}},
101 {"name": "RasterTask", "ts": 3200001, "ph": "B", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args":{"layerId":11} },
102 {"name": "RasterTask", "ts": 3299900, "ph": "E", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args":{}},
103 {"name": "Program", "ts": 3299999, "ph": "E", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {}},
104 {"name": "Program", "ts": 3300000, "ph": "B", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {}},
105 {"name": "RasterTask", "ts": 3300001, "ph": "B", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args":{"layerId":11} },
106 {"name": "RasterTask", "ts": 3399900, "ph": "E", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args":{}},
107 {"name": "Program", "ts": 3399999, "ph": "E", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {}},
108
109 // Assure we only coalesce event records with the same type.
110 {"name": "Program", "ts": 4100000, "ph": "B", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {}},
111 {"name": "Paint", "ts": 4100001, "dur": 99899, "ph": "X", "tid": mai nThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args":{"dat a":{"clip":[-15,-15,512,-15,512,512,-15,512],"frame":"0x2","layerId":11,"nodeId" :2, "type": "mouseover" }}},
112 {"name": "Program", "ts": 4199999, "ph": "E", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {}},
113 {"name": "Program", "ts": 4200000, "ph": "B", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {}},
114 {"name": "Paint", "ts": 4200001, "dur": 99899, "ph": "X", "tid": mai nThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args":{"dat a":{"clip":[-15,-15,512,-15,512,512,-15,512],"frame":"0x2","layerId":11,"nodeId" :2, "type": "mouseover" }}},
115 {"name": "Program", "ts": 4299999, "ph": "E", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {}},
116 {"name": "Program", "ts": 4300000, "ph": "B", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {}},
117 {"name": "Paint", "ts": 4300001, "dur": 99899, "ph": "X", "tid": mai nThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args":{"dat a":{"clip":[-15,-15,512,-15,512,512,-15,512],"frame":"0x2","layerId":11,"nodeId" :2, "type": "keydown" }}},
118 {"name": "Program", "ts": 4399999, "ph": "E", "tid": mainThread, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {}}
119 ];
120
121 InspectorTest.timelineModel().setEventsForTest(sessionId, testData);
122
123 var rootRecord = InspectorTest.timelinePresentationModel().rootRecord();
124 InspectorTest.dumpPresentationRecord(rootRecord, InspectorTest.dumpStats);
125 var coalesced = rootRecord.presentationChildren()[0];
126 InspectorTest.addResult("coalesced record's hasWarnings(): " + coalesced.has Warnings());
127 InspectorTest.addResult("coalesced record's childHasWarnings(): " + coalesce d.childHasWarnings());
128 InspectorTest.completeTest();
129 }
130
131 </script>
132 </head>
133
134 <body onload="runTest()">
135 <p>
136 Test timeline records coalescing
137 </p>
138
139 </body>
140 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698