3 <script src=
"../../http/tests/inspector/inspector-test.js"></script>
4 <script src=
"../tracing-test.js"></script>
8 var sessionId
= "6.23";
15 "name": "process_name",
23 "name": "CrRendererMain"
26 "name": "thread_name",
34 "sessionId": sessionId
36 "cat": "disabled-by-default-devtools.timeline",
37 "name": "TracingStartedInPage",
46 "cat": "disabled-by-default-devtools.timeline",
58 { "functionName": "c", "callUID": "c", "scriptId": 1 },
59 { "functionName": "b", "callUID": "b", "scriptId": 1 },
60 { "functionName": "a", "callUID": "a", "scriptId": 1 }
64 "cat": "disabled-by-default-devtools.timeline",
74 "cat": "disabled-by-default-devtools.timeline",
75 "name": "FunctionCall",
87 { "functionName": "c", "callUID": "c", "scriptId": 1 },
88 { "functionName": "b", "callUID": "b", "scriptId": 1 },
89 { "functionName": "a", "callUID": "a", "scriptId": 1 }
93 "cat": "disabled-by-default-devtools.timeline",
107 "cat": "disabled-by-default-devtools.timeline",
119 { "functionName": "c", "callUID": "c", "scriptId": 1 },
120 { "functionName": "b", "callUID": "b", "scriptId": 1 },
121 { "functionName": "a", "callUID": "a", "scriptId": 1 }
125 "cat": "disabled-by-default-devtools.timeline",
135 "frame": "0x2f7b63884000",
138 { "functionName": "b", "callUID": "b", "scriptId": 1 },
139 { "functionName": "a", "callUID": "a", "scriptId": 1 }
143 "cat": "disabled-by-default-devtools.timeline",
144 "name": "InvalidateLayout",
156 { "functionName": "c", "callUID": "c", "scriptId": 1 },
157 { "functionName": "b", "callUID": "b", "scriptId": 1 },
158 { "functionName": "a", "callUID": "a", "scriptId": 1 }
162 "cat": "disabled-by-default-devtools.timeline",
172 "frame": "0x2f7b63884000",
175 { "functionName": "b", "callUID": "b", "scriptId": 1 },
176 { "functionName": "a", "callUID": "a", "scriptId": 1 }
180 "cat": "disabled-by-default-devtools.timeline",
181 "name": "InvalidateLayout",
193 { "functionName": "g", "scriptId": 1 },
194 { "functionName": "f", "scriptId": 1 },
195 { "functionName": "b", "scriptId": 1 },
196 { "functionName": "a", "scriptId": 1 }
200 "cat": "disabled-by-default-devtools.timeline",
212 { "functionName": "g", "scriptId": 1 },
213 { "functionName": "e", "scriptId": 1 },
214 { "functionName": "b", "scriptId": 1 },
215 { "functionName": "a", "scriptId": 1 }
219 "cat": "disabled-by-default-devtools.timeline",
231 { "functionName": "g", "scriptId": 1 },
232 { "functionName": "e", "scriptId": 1 },
233 { "functionName": "b", "scriptId": 1 },
234 { "functionName": "a", "scriptId": 1 }
238 "cat": "disabled-by-default-devtools.timeline",
250 { "functionName": "a", "callUID": "a", "scriptId": 1 },
251 { "functionName": "l", "callUID": "l", "scriptId": 1 },
252 { "functionName": "f", "callUID": "f", "scriptId": 1 }
256 "cat": "disabled-by-default-devtools.timeline",
268 { "functionName": "a", "callUID": "a", "scriptId": 1 },
269 { "functionName": "l", "callUID": "l", "scriptId": 1 },
270 { "functionName": "f", "callUID": "f", "scriptId": 1 },
271 { "functionName": "sin", "callUID": "sin", "scriptId": 2, "url": "native math.js" }
275 "cat": "disabled-by-default-devtools.timeline",
288 { "functionName": "a", "callUID": "a", "scriptId": 1 },
289 { "functionName": "l", "callUID": "l", "scriptId": 1 },
290 { "functionName": "f", "callUID": "f", "scriptId": 1 },
291 { "functionName": "sin", "callUID": "sin", "scriptId": 2, "url": "native math.js" }
295 "cat": "disabled-by-default-devtools.timeline",
305 "cat": "disabled-by-default-devtools.timeline",
306 "name": "FunctionCall",
317 { "functionName": "y", "callUID": "y", "scriptId": 1 },
318 { "functionName": "x", "callUID": "x", "scriptId": 1 }
322 "cat": "disabled-by-default-devtools.timeline",
323 "name": "FunctionCall",
334 { "functionName": "w", "callUID": "w", "scriptId": 1 },
335 { "functionName": "z", "callUID": "z", "scriptId": 1 },
336 { "functionName": "y", "callUID": "y", "scriptId": 1 },
337 { "functionName": "x", "callUID": "x", "scriptId": 1 }
341 "cat": "disabled-by-default-devtools.timeline",
352 { "functionName": "w", "callUID": "w", "scriptId": 1 },
353 { "functionName": "z", "callUID": "z", "scriptId": 1 },
354 { "functionName": "y", "callUID": "y", "scriptId": 1 },
355 { "functionName": "x", "callUID": "x", "scriptId": 1 }
359 "cat": "disabled-by-default-devtools.timeline",
370 { "functionName": "w", "scriptId": 1 },
371 { "functionName": "y", "callUID": "y", "scriptId": 1 },
372 { "functionName": "x", "callUID": "x", "scriptId": 1 }
376 "cat": "disabled-by-default-devtools.timeline",
387 { "functionName": "w", "scriptId": 1 },
388 { "functionName": "y", "callUID": "y", "scriptId": 1 },
389 { "functionName": "x", "callUID": "x", "scriptId": 1 }
393 "cat": "disabled-by-default-devtools.timeline",
404 { "functionName": "y", "callUID": "y", "scriptId": 1 },
405 { "functionName": "x", "callUID": "x", "scriptId": 1 }
409 "cat": "disabled-by-default-devtools.timeline",
420 { "functionName": "recursive_b", "scriptId": 1 },
421 { "functionName": "recursive_a", "scriptId": 1 },
422 { "functionName": "recursive_b", "scriptId": 1 },
423 { "functionName": "recursive_a", "scriptId": 1 }
427 "cat": "disabled-by-default-devtools.timeline",
438 { "functionName": "recursive_a", "scriptId": 1 },
439 { "functionName": "recursive_b", "scriptId": 1 },
440 { "functionName": "recursive_a", "scriptId": 1 }
444 "cat": "disabled-by-default-devtools.timeline",
455 { "functionName": "recursive_b", "scriptId": 1 },
456 { "functionName": "recursive_a", "scriptId": 1 }
460 "cat": "disabled-by-default-devtools.timeline",
471 { "functionName": "recursive_a", "scriptId": 1 }
475 "cat": "disabled-by-default-devtools.timeline",
489 "cat": "disabled-by-default-devtools.timeline",
500 { "functionName": "recursive_b", "scriptId": 1 },
501 { "functionName": "recursive_a", "scriptId": 1 }
505 "cat": "disabled-by-default-devtools.timeline",
516 { "functionName": "recursive_a", "scriptId": 1 }
520 "cat": "disabled-by-default-devtools.timeline",
534 "cat": "disabled-by-default-devtools.timeline",
543 "cat": "disabled-by-default-devtools.timeline",
553 var tracingTimelineModel
= InspectorTest
.tracingTimelineModel();
554 tracingTimelineModel
.setEventsForTest(rawTraceEvents
);
555 var events
= WebInspector
.TimelineJSProfileProcessor
.generateJSFrameEvents(tracingTimelineModel
.mainThreadEvents());
556 events
= events
.mergeOrdered(tracingTimelineModel
.mainThreadEvents(), WebInspector
.TracingModel
.Event
.orderedCompareStartTime
);
557 events
.filter(function(e
) { return e
.duration
; }).forEach(function(e
) {
558 InspectorTest
.addResult(e
.name
+ ": " + e
.startTime
.toFixed(3) + " / " + (e
.duration
.toFixed(3) || 0) + " " + (e
.args
.data
&& e
.args
.data
.functionName
|| ""));
561 InspectorTest
.addResult("");
562 tracingTimelineModel
._setMainThreadEvents(events
);
564 WebInspector
.TimelineUIUtils
.visibleEventsFilter(),
565 new WebInspector
.ExcludeTopLevelFilter()
567 var treeTopDown
= WebInspector
.TimelineModel
.buildTopDownTree(events
, 0, Infinity
, filters
, WebInspector
.TimelineTreeView
.eventId
);
568 printProfileTree(0, treeTopDown
);
569 var treeBottomUp
= WebInspector
.TimelineModel
.buildBottomUpTree(treeTopDown
);
570 printProfileTree(0, treeBottomUp
);
572 function printProfileTree(padding
, node
)
574 var name
= node
.name
|| (node
.event
.name
=== WebInspector
.TimelineModel
.RecordType
.JSFrame
575 ? WebInspector
.beautifyFunctionName(node
.event
.args
["data"]["functionName"])
576 : WebInspector
.TimelineUIUtils
.eventTitle(node
.event
));
577 InspectorTest
.addResult(" ".repeat(padding
) + name
+ ": " + [node
.selfTime
, node
.totalTime
].map(function (t
) { return t
.toFixed(3); }).join(" "));
578 (node
.children
|| new Map()).forEach(printProfileTree
.bind(null, padding
+ 1));
581 InspectorTest
.completeTest();
586 <body onload=
"runTest()">