| 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="../../http/tests/inspector/timeline-test.js"></script> | 4 <script src="../../http/tests/inspector/timeline-test.js"></script> |
| 5 <script> | 5 <script> |
| 6 | 6 |
| 7 function initialize_TimelineCoalescing() | 7 function initialize_TimelineCoalescing() |
| 8 { | 8 { |
| 9 | 9 |
| 10 InspectorTest.dumpStats = function(presentationRecord) | 10 InspectorTest.dumpStats = function(presentationRecord) |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 {"startTime":4100.001, "endTime":4199.9,"type":"Paint","frameId":"2"
,"data":{ type: "mouseover" }} | 84 {"startTime":4100.001, "endTime":4199.9,"type":"Paint","frameId":"2"
,"data":{ type: "mouseover" }} |
| 85 ]}, | 85 ]}, |
| 86 {"startTime":4200.000,"data":{},"endTime":4299.999,"type":"Program","chi
ldren":[ | 86 {"startTime":4200.000,"data":{},"endTime":4299.999,"type":"Program","chi
ldren":[ |
| 87 {"startTime":4200.001, "endTime":4299.9,"type":"Paint","frameId":"2"
,"data":{ type: "mouseover" }} | 87 {"startTime":4200.001, "endTime":4299.9,"type":"Paint","frameId":"2"
,"data":{ type: "mouseover" }} |
| 88 ]}, | 88 ]}, |
| 89 {"startTime":4300.000,"data":{},"endTime":4399.999,"type":"Program","chi
ldren":[ | 89 {"startTime":4300.000,"data":{},"endTime":4399.999,"type":"Program","chi
ldren":[ |
| 90 {"startTime":4300.001, "endTime":4399.9,"type":"Paint","frameId":"2"
,"data":{ type: "keydown" }} | 90 {"startTime":4300.001, "endTime":4399.9,"type":"Paint","frameId":"2"
,"data":{ type: "keydown" }} |
| 91 ]} | 91 ]} |
| 92 ]; | 92 ]; |
| 93 | 93 |
| 94 InspectorTest.loadTimelineRecords(records); | 94 |
| 95 var sessionId = "4.20"; |
| 96 var mainThread = 1; |
| 97 var pid = 100; |
| 98 |
| 99 var testData = [ |
| 100 // Assure we coalesce records with short interval and don't coalesce rec
ords that stand apart. |
| 101 { |
| 102 "args": { "sessionId": sessionId }, |
| 103 "cat": "disabled-by-default-devtools.timeline", |
| 104 "name": "TracingStartedInPage", |
| 105 "ph": "I", |
| 106 "pid": pid, |
| 107 "tid": mainThread, |
| 108 "ts": 100, |
| 109 }, |
| 110 {"name": "Program", "ts": 1000000, "ph": "B", "tid": mainThread, "pid":
pid, "cat":"disabled-by-default.devtools.timeline", "args": {}}, |
| 111 {"name": "Layout", "ts": 1000001, "ph": "B", "tid": mainThread, "pid
": pid, "cat":"disabled-by-default.devtools.timeline", "args":{"beginData":{"dir
tyObjects":1,"frame":"0x2","partialLayout":false,"totalObjects":1}} }, |
| 112 {"name": "CallStack", "ts": 1000002, "ph": "I", "tid": mainThrea
d, "pid": pid, "cat":"disabled-by-default.devtools.timeline.stack", "args":{ |
| 113 "stack":[ |
| 114 {"functionName":"func","url":"http://example.com","lineN
umber":42,"columnNumber":1,"scriptId":"10"} |
| 115 ]} |
| 116 }, |
| 117 {"name": "Layout", "ts": 1099900, "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}}}, |
| 118 {"name": "Program", "ts": 1099999, "ph": "E", "tid": mainThread, "pid":
pid, "cat":"disabled-by-default.devtools.timeline", "args": {}}, |
| 119 |
| 120 |
| 121 {"name": "Program", "ts": 1100000, "ph": "B", "tid": mainThread, "pid":
pid, "cat":"disabled-by-default.devtools.timeline", "args": {}}, |
| 122 {"name": "Layout", "ts": 1100001, "ph": "B", "tid": mainThread, "pid
": pid, "cat":"disabled-by-default.devtools.timeline", "args":{"beginData":{"dir
tyObjects":1,"frame":"0x2","partialLayout":false,"totalObjects":1}} }, |
| 123 {"name": "Layout", "ts": 1199900, "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}}}, |
| 124 {"name": "Program", "ts": 1199999, "ph": "E", "tid": mainThread, "pid":
pid, "cat":"disabled-by-default.devtools.timeline", "args": {}}, |
| 125 |
| 126 {"name": "Program", "ts": 1200000, "ph": "B", "tid": mainThread, "pid":
pid, "cat":"disabled-by-default.devtools.timeline", "args": {}}, |
| 127 {"name": "Layout", "ts": 1200001, "ph": "B", "tid": mainThread, "pid
": pid, "cat":"disabled-by-default.devtools.timeline", "args":{"beginData":{"dir
tyObjects":1,"frame":"0x2","partialLayout":false,"totalObjects":1}} }, |
| 128 {"name": "Layout", "ts": 1299900, "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}}}, |
| 129 {"name": "Program", "ts": 1299999, "ph": "E", "tid": mainThread, "pid":
pid, "cat":"disabled-by-default.devtools.timeline", "args": {}}, |
| 130 |
| 131 |
| 132 {"name": "Program", "ts": 1300000, "ph": "B", "tid": mainThread, "pid":
pid, "cat":"disabled-by-default.devtools.timeline", "args": {}}, |
| 133 {"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}} }, |
| 134 {"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}}}, |
| 135 {"name": "Program", "ts": 1399999, "ph": "E", "tid": mainThread, "pid":
pid, "cat":"disabled-by-default.devtools.timeline", "args": {}}, |
| 136 |
| 137 // Assure we do coalesce on levels lower than root, but do not coalesce
between different parents. |
| 138 {"name": "Program", "ts": 2000000, "ph": "B", "tid": mainThread, "pid":
pid, "cat":"disabled-by-default.devtools.timeline", "args": {}}, |
| 139 {"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"}}}, |
| 140 {"name": "Decode Image", "ts": 2000002, "ph": "B", "tid": mainTh
read, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args":{"imageT
ype":"JPEG"}}, |
| 141 {"name": "Decode Image", "ts": 2099900, "ph": "E", "tid": mainTh
read, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {}}, |
| 142 {"name": "Decode Image", "ts": 2100000, "ph": "B", "tid": mainTh
read, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args":{"imageT
ype":"JPEG"}}, |
| 143 {"name": "Decode Image", "ts": 2199900, "ph": "E", "tid": mainTh
read, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {}}, |
| 144 {"name": "FunctionCall", "ts": 2199998, "ph": "E", "tid": mainThread
, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {}}, |
| 145 {"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"}}}, |
| 146 {"name": "Decode Image", "ts": 2200002, "ph": "B", "tid": mainTh
read, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args":{"imageT
ype":"JPEG"}}, |
| 147 {"name": "Decode Image", "ts": 2299900, "ph": "E", "tid": mainTh
read, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {}}, |
| 148 {"name": "Decode Image", "ts": 2300000, "ph": "B", "tid": mainTh
read, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args":{"imageT
ype":"JPEG"}}, |
| 149 {"name": "Decode Image", "ts": 2399900, "ph": "E", "tid": mainTh
read, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {}}, |
| 150 {"name": "FunctionCall", "ts": 2399998, "ph": "E", "tid": mainThread
, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {}}, |
| 151 {"name": "Program", "ts": 2399999, "ph": "E", "tid": mainThread, "pid":
pid, "cat":"disabled-by-default.devtools.timeline", "args": {}}, |
| 152 |
| 153 // Assure we only coalesce timestamp records with the same message. |
| 154 {"name": "Program", "ts": 3100000, "ph": "B", "tid": mainThread, "pid":
pid, "cat":"disabled-by-default.devtools.timeline", "args": {}}, |
| 155 {"name": "RasterTask", "ts": 3100001, "ph": "B", "tid": mainThread,
"pid": pid, "cat":"disabled-by-default.devtools.timeline", "args":{"layerId":11}
}, |
| 156 {"name": "RasterTask", "ts": 3199900, "ph": "E", "tid": mainThread,
"pid": pid, "cat":"disabled-by-default.devtools.timeline", "args":{}}, |
| 157 {"name": "Program", "ts": 3199999, "ph": "E", "tid": mainThread, "pid":
pid, "cat":"disabled-by-default.devtools.timeline", "args": {}}, |
| 158 {"name": "Program", "ts": 3200000, "ph": "B", "tid": mainThread, "pid":
pid, "cat":"disabled-by-default.devtools.timeline", "args": {}}, |
| 159 {"name": "RasterTask", "ts": 3200001, "ph": "B", "tid": mainThread,
"pid": pid, "cat":"disabled-by-default.devtools.timeline", "args":{"layerId":11}
}, |
| 160 {"name": "RasterTask", "ts": 3299900, "ph": "E", "tid": mainThread,
"pid": pid, "cat":"disabled-by-default.devtools.timeline", "args":{}}, |
| 161 {"name": "Program", "ts": 3299999, "ph": "E", "tid": mainThread, "pid":
pid, "cat":"disabled-by-default.devtools.timeline", "args": {}}, |
| 162 {"name": "Program", "ts": 3300000, "ph": "B", "tid": mainThread, "pid":
pid, "cat":"disabled-by-default.devtools.timeline", "args": {}}, |
| 163 {"name": "RasterTask", "ts": 3300001, "ph": "B", "tid": mainThread,
"pid": pid, "cat":"disabled-by-default.devtools.timeline", "args":{"layerId":11}
}, |
| 164 {"name": "RasterTask", "ts": 3399900, "ph": "E", "tid": mainThread,
"pid": pid, "cat":"disabled-by-default.devtools.timeline", "args":{}}, |
| 165 {"name": "Program", "ts": 3399999, "ph": "E", "tid": mainThread, "pid":
pid, "cat":"disabled-by-default.devtools.timeline", "args": {}}, |
| 166 |
| 167 // Assure we only coalesce event records with the same type. |
| 168 {"name": "Program", "ts": 4100000, "ph": "B", "tid": mainThread, "pid":
pid, "cat":"disabled-by-default.devtools.timeline", "args": {}}, |
| 169 {"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" }}}, |
| 170 {"name": "Program", "ts": 4199999, "ph": "E", "tid": mainThread, "pid":
pid, "cat":"disabled-by-default.devtools.timeline", "args": {}}, |
| 171 {"name": "Program", "ts": 4200000, "ph": "B", "tid": mainThread, "pid":
pid, "cat":"disabled-by-default.devtools.timeline", "args": {}}, |
| 172 {"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" }}}, |
| 173 {"name": "Program", "ts": 4299999, "ph": "E", "tid": mainThread, "pid":
pid, "cat":"disabled-by-default.devtools.timeline", "args": {}}, |
| 174 {"name": "Program", "ts": 4300000, "ph": "B", "tid": mainThread, "pid":
pid, "cat":"disabled-by-default.devtools.timeline", "args": {}}, |
| 175 {"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" }}}, |
| 176 {"name": "Program", "ts": 4399999, "ph": "E", "tid": mainThread, "pid":
pid, "cat":"disabled-by-default.devtools.timeline", "args": {}} |
| 177 ]; |
| 178 |
| 179 InspectorTest.loadTimelineTraceEvents(sessionId, testData); |
| 95 | 180 |
| 96 var rootRecord = InspectorTest.timelinePresentationModel().rootRecord(); | 181 var rootRecord = InspectorTest.timelinePresentationModel().rootRecord(); |
| 97 InspectorTest.dumpPresentationRecord(rootRecord, InspectorTest.dumpStats); | 182 InspectorTest.dumpPresentationRecord(rootRecord, InspectorTest.dumpStats); |
| 98 var coalesced = rootRecord.presentationChildren()[0]; | 183 var coalesced = rootRecord.presentationChildren()[0]; |
| 99 InspectorTest.addResult("coalesced record's hasWarnings(): " + coalesced.has
Warnings()); | 184 InspectorTest.addResult("coalesced record's hasWarnings(): " + coalesced.has
Warnings()); |
| 100 InspectorTest.addResult("coalesced record's childHasWarnings(): " + coalesce
d.childHasWarnings()); | 185 InspectorTest.addResult("coalesced record's childHasWarnings(): " + coalesce
d.childHasWarnings()); |
| 101 InspectorTest.completeTest(); | 186 InspectorTest.completeTest(); |
| 102 } | 187 } |
| 103 | 188 |
| 104 </script> | 189 </script> |
| 105 </head> | 190 </head> |
| 106 | 191 |
| 107 <body onload="runTest()"> | 192 <body onload="runTest()"> |
| 108 <p> | 193 <p> |
| 109 Test timeline records coalescing | 194 Test timeline records coalescing |
| 110 </p> | 195 </p> |
| 111 | 196 |
| 112 </body> | 197 </body> |
| 113 </html> | 198 </html> |
| OLD | NEW |