| 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 20 matching lines...) Expand all Loading... |
| 31 } | 31 } |
| 32 var duration = (presentationRecord.endTime() - presentationRecord.startTime(
)).toFixed(5); | 32 var duration = (presentationRecord.endTime() - presentationRecord.startTime(
)).toFixed(5); |
| 33 var durationTillLastChild = (presentationRecord.endTime() - presentationReco
rd.startTime()).toFixed(5); | 33 var durationTillLastChild = (presentationRecord.endTime() - presentationReco
rd.startTime()).toFixed(5); |
| 34 return "duration: " + duration + ":" + durationTillLastChild + (timeByCatego
ry ? " (" + timeByCategory + ")" : ""); | 34 return "duration: " + duration + ":" + durationTillLastChild + (timeByCatego
ry ? " (" + timeByCategory + ")" : ""); |
| 35 } | 35 } |
| 36 | 36 |
| 37 } | 37 } |
| 38 | 38 |
| 39 function test() | 39 function test() |
| 40 { | 40 { |
| 41 var records = [ | 41 var sessionId = "4.20"; |
| 42 // Assure we coalesce records with sort interval and don't coalesce reco
rds that stand apart. | 42 var mainThread = 1; |
| 43 {"startTime": 1000.000,"data":{},"endTime":1099.999,"type":"Program","ch
ildren":[ | 43 var pid = 100; |
| 44 {"startTime":1000.001, "endTime":1099.9,"type":"Layout","frameId":"2
","data":{}, | 44 |
| 45 "stackTrace": [ | 45 var testData = [ |
| 46 {"functionName":"func","url":"http://example.com","lineNumber":4
2,"columnNumber":1} | 46 // Assure we coalesce records with short interval and don't coalesce rec
ords that stand apart. |
| 47 ]} | 47 { |
| 48 ]}, | 48 "args": { "sessionId": sessionId }, |
| 49 {"startTime":1100.000,"data":{},"endTime":1199.999,"type":"Program","chi
ldren":[ | 49 "cat": "disabled-by-default-devtools.timeline", |
| 50 {"startTime":1100.001, "endTime":1199.9,"type":"Layout","frameId":"2
","data":{}} | 50 "name": "TracingStartedInPage", |
| 51 ]}, | 51 "ph": "I", |
| 52 {"startTime":1200.000,"data":{},"endTime":1299.999,"type":"Program","chi
ldren":[ | 52 "pid": pid, |
| 53 {"startTime":1200.001, "endTime":1299.9,"type":"Layout","frameId":"2
","data":{}} | 53 "tid": mainThread, |
| 54 ]}, | 54 "ts": 100, |
| 55 {"startTime":1300.000,"data":{},"endTime":1399.999,"type":"Program","chi
ldren":[ | 55 }, |
| 56 {"startTime":1305.001, "endTime":1399.9,"type":"Layout","frameId":"2
","data":{}} | 56 {"name": "Program", "ts": 1000000, "ph": "B", "tid": mainThread, "pid":
pid, "cat":"disabled-by-default.devtools.timeline", "args": {}}, |
| 57 ]}, | 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": {}}, |
| 58 | 78 |
| 59 // Assure we do coalesce on levels lower than root, but do not coalesce
between different parents. | 79 // Assure we do coalesce on levels lower than root, but do not coalesce
between different parents. |
| 60 {"startTime":2000.000,"data":{},"endTime":2399.999,"type":"Program","chi
ldren":[ | 80 {"name": "Program", "ts": 2000000, "ph": "B", "tid": mainThread, "pid":
pid, "cat":"disabled-by-default.devtools.timeline", "args": {}}, |
| 61 {"startTime":2000.001,"data":{},"endTime":2199.998,"type":"FunctionC
all","children":[ | 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"}}}, |
| 62 {"startTime":2000.002, "endTime":2099.9,"type":"DecodeImage","fr
ameId":"2","data":{}}, | 82 {"name": "Decode Image", "ts": 2000002, "ph": "B", "tid": mainTh
read, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args":{"imageT
ype":"JPEG"}}, |
| 63 {"startTime":2100.000, "endTime":2199.9,"type":"DecodeImage","fr
ameId":"2","data":{}} | 83 {"name": "Decode Image", "ts": 2099900, "ph": "E", "tid": mainTh
read, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {}}, |
| 64 ]}, | 84 {"name": "Decode Image", "ts": 2100000, "ph": "B", "tid": mainTh
read, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args":{"imageT
ype":"JPEG"}}, |
| 65 {"startTime":2200.001,"data":{},"endTime":2399.998,"type":"FunctionC
all","children":[ | 85 {"name": "Decode Image", "ts": 2199900, "ph": "E", "tid": mainTh
read, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {}}, |
| 66 {"startTime":2200.002, "endTime":2299.9,"type":"DecodeImage","fr
ameId":"2","data":{}}, | 86 {"name": "FunctionCall", "ts": 2199998, "ph": "E", "tid": mainThread
, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args": {}}, |
| 67 {"startTime":2300.000, "endTime":2399.9,"type":"DecodeImage","fr
ameId":"2","data":{}} | 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"}}}, |
| 68 ]}, | 88 {"name": "Decode Image", "ts": 2200002, "ph": "B", "tid": mainTh
read, "pid": pid, "cat":"disabled-by-default.devtools.timeline", "args":{"imageT
ype":"JPEG"}}, |
| 69 ]}, | 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": {}}, |
| 70 | 94 |
| 71 // Assure we only coalesce timestamp records with the same message. | 95 // Assure we only coalesce timestamp records with the same message. |
| 72 {"startTime":3100.000,"data":{},"endTime":3199.999,"type":"Program","chi
ldren":[ | 96 {"name": "Program", "ts": 3100000, "ph": "B", "tid": mainThread, "pid":
pid, "cat":"disabled-by-default.devtools.timeline", "args": {}}, |
| 73 {"startTime":3100.001, "endTime":3199.9,"type":"Rasterize","frameId"
:"2","data":{ message: "foo" }} | 97 {"name": "RasterTask", "ts": 3100001, "ph": "B", "tid": mainThread,
"pid": pid, "cat":"disabled-by-default.devtools.timeline", "args":{"layerId":11}
}, |
| 74 ]}, | 98 {"name": "RasterTask", "ts": 3199900, "ph": "E", "tid": mainThread,
"pid": pid, "cat":"disabled-by-default.devtools.timeline", "args":{}}, |
| 75 {"startTime":3200.000,"data":{},"endTime":3299.999,"type":"Program","chi
ldren":[ | 99 {"name": "Program", "ts": 3199999, "ph": "E", "tid": mainThread, "pid":
pid, "cat":"disabled-by-default.devtools.timeline", "args": {}}, |
| 76 {"startTime":3200.001, "endTime":3299.9,"type":"Rasterize","frameId"
:"2","data":{ message: "foo" }} | 100 {"name": "Program", "ts": 3200000, "ph": "B", "tid": mainThread, "pid":
pid, "cat":"disabled-by-default.devtools.timeline", "args": {}}, |
| 77 ]}, | 101 {"name": "RasterTask", "ts": 3200001, "ph": "B", "tid": mainThread,
"pid": pid, "cat":"disabled-by-default.devtools.timeline", "args":{"layerId":11}
}, |
| 78 {"startTime":3300.000,"data":{},"endTime":3399.999,"type":"Program","chi
ldren":[ | 102 {"name": "RasterTask", "ts": 3299900, "ph": "E", "tid": mainThread,
"pid": pid, "cat":"disabled-by-default.devtools.timeline", "args":{}}, |
| 79 {"startTime":3300.001, "endTime":3399.9,"type":"Rasterize","frameId"
:"2","data":{ message: "bar" }} | 103 {"name": "Program", "ts": 3299999, "ph": "E", "tid": mainThread, "pid":
pid, "cat":"disabled-by-default.devtools.timeline", "args": {}}, |
| 80 ]}, | 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": {}}, |
| 81 | 108 |
| 82 // Assure we only coalesce event records with the same type. | 109 // Assure we only coalesce event records with the same type. |
| 83 {"startTime":4100.000,"data":{},"endTime":4199.999,"type":"Program","chi
ldren":[ | 110 {"name": "Program", "ts": 4100000, "ph": "B", "tid": mainThread, "pid":
pid, "cat":"disabled-by-default.devtools.timeline", "args": {}}, |
| 84 {"startTime":4100.001, "endTime":4199.9,"type":"Paint","frameId":"2"
,"data":{ type: "mouseover" }} | 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" }}}, |
| 85 ]}, | 112 {"name": "Program", "ts": 4199999, "ph": "E", "tid": mainThread, "pid":
pid, "cat":"disabled-by-default.devtools.timeline", "args": {}}, |
| 86 {"startTime":4200.000,"data":{},"endTime":4299.999,"type":"Program","chi
ldren":[ | 113 {"name": "Program", "ts": 4200000, "ph": "B", "tid": mainThread, "pid":
pid, "cat":"disabled-by-default.devtools.timeline", "args": {}}, |
| 87 {"startTime":4200.001, "endTime":4299.9,"type":"Paint","frameId":"2"
,"data":{ type: "mouseover" }} | 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" }}}, |
| 88 ]}, | 115 {"name": "Program", "ts": 4299999, "ph": "E", "tid": mainThread, "pid":
pid, "cat":"disabled-by-default.devtools.timeline", "args": {}}, |
| 89 {"startTime":4300.000,"data":{},"endTime":4399.999,"type":"Program","chi
ldren":[ | 116 {"name": "Program", "ts": 4300000, "ph": "B", "tid": mainThread, "pid":
pid, "cat":"disabled-by-default.devtools.timeline", "args": {}}, |
| 90 {"startTime":4300.001, "endTime":4399.9,"type":"Paint","frameId":"2"
,"data":{ type: "keydown" }} | 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" }}}, |
| 91 ]} | 118 {"name": "Program", "ts": 4399999, "ph": "E", "tid": mainThread, "pid":
pid, "cat":"disabled-by-default.devtools.timeline", "args": {}} |
| 92 ]; | 119 ]; |
| 93 | 120 |
| 94 InspectorTest.loadTimelineRecords(records); | 121 InspectorTest.loadTimelineTraceEvents(sessionId, testData); |
| 95 | 122 |
| 96 var rootRecord = InspectorTest.timelinePresentationModel().rootRecord(); | 123 var rootRecord = InspectorTest.timelinePresentationModel().rootRecord(); |
| 97 InspectorTest.dumpPresentationRecord(rootRecord, InspectorTest.dumpStats); | 124 InspectorTest.dumpPresentationRecord(rootRecord, InspectorTest.dumpStats); |
| 98 var coalesced = rootRecord.presentationChildren()[0]; | 125 var coalesced = rootRecord.presentationChildren()[0]; |
| 99 InspectorTest.addResult("coalesced record's hasWarnings(): " + coalesced.has
Warnings()); | 126 InspectorTest.addResult("coalesced record's hasWarnings(): " + coalesced.has
Warnings()); |
| 100 InspectorTest.addResult("coalesced record's childHasWarnings(): " + coalesce
d.childHasWarnings()); | 127 InspectorTest.addResult("coalesced record's childHasWarnings(): " + coalesce
d.childHasWarnings()); |
| 101 InspectorTest.completeTest(); | 128 InspectorTest.completeTest(); |
| 102 } | 129 } |
| 103 | 130 |
| 104 </script> | 131 </script> |
| 105 </head> | 132 </head> |
| 106 | 133 |
| 107 <body onload="runTest()"> | 134 <body onload="runTest()"> |
| 108 <p> | 135 <p> |
| 109 Test timeline records coalescing | 136 Test timeline records coalescing |
| 110 </p> | 137 </p> |
| 111 | 138 |
| 112 </body> | 139 </body> |
| 113 </html> | 140 </html> |
| OLD | NEW |