| 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 test() | 7 function initialize_ProductsExperiment() |
| 8 { |
| 9 Runtime.experiments.enableForTest('timelineColorByProduct'); |
| 10 } |
| 11 |
| 12 async function test() |
| 8 { | 13 { |
| 9 var sessionId = "6.23"; | 14 var sessionId = "6.23"; |
| 10 var rawTraceEvents = [ | 15 var rawTraceEvents = [ |
| 11 { | 16 { |
| 12 "args": { | 17 "args": { |
| 13 "name": "Renderer" | 18 "name": "Renderer" |
| 14 }, | 19 }, |
| 15 "cat": "__metadata", | 20 "cat": "__metadata", |
| 16 "name": "process_name", | 21 "name": "process_name", |
| 17 "ph": "M", | 22 "ph": "M", |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 "name": "JSSample", | 467 "name": "JSSample", |
| 463 "ph": "I", | 468 "ph": "I", |
| 464 "pid": 17851, | 469 "pid": 17851, |
| 465 "tid": 23, | 470 "tid": 23, |
| 466 "ts": 251400 | 471 "ts": 251400 |
| 467 }, | 472 }, |
| 468 { | 473 { |
| 469 "args": { | 474 "args": { |
| 470 "data": { | 475 "data": { |
| 471 "stackTrace": [ | 476 "stackTrace": [ |
| 472 { "functionName": "recursive_b", "scriptId": 1, "url": "http
://xyz.abc.com/rec.js" }, | 477 { "functionName": "recursive_b", "scriptId": 1, "url": "http
://www.google.com/rec.js" }, |
| 473 { "functionName": "recursive_a", "scriptId": 1, "url": "http
://xyz.abc.com/rec.js" }, | 478 { "functionName": "recursive_a", "scriptId": 1, "url": "http
://www.google.com/rec.js" }, |
| 474 { "functionName": "recursive_b", "scriptId": 1, "url": "http
://xyz.abc.com/rec.js" }, | 479 { "functionName": "recursive_b", "scriptId": 1, "url": "http
://www.google.com/rec.js" }, |
| 475 { "functionName": "recursive_a", "scriptId": 1, "url": "http
://xyz.abc.com/rec.js" } | 480 { "functionName": "recursive_a", "scriptId": 1, "url": "http
://www.google.com/rec.js" } |
| 476 ] | 481 ] |
| 477 } | 482 } |
| 478 }, | 483 }, |
| 479 "cat": "disabled-by-default-devtools.timeline", | 484 "cat": "disabled-by-default-devtools.timeline", |
| 480 "name": "JSSample", | 485 "name": "JSSample", |
| 481 "ph": "I", | 486 "ph": "I", |
| 482 "pid": 17851, | 487 "pid": 17851, |
| 483 "tid": 23, | 488 "tid": 23, |
| 484 "ts": 253000 | 489 "ts": 253000 |
| 485 }, | 490 }, |
| 486 { | 491 { |
| 487 "args": { | 492 "args": { |
| 488 "data": { | 493 "data": { |
| 489 "stackTrace": [ | 494 "stackTrace": [ |
| 490 { "functionName": "recursive_a", "scriptId": 1, "url": "http
://xyz.abc.com/rec.js" }, | 495 { "functionName": "recursive_a", "scriptId": 1, "url": "http
://www.google.com/rec.js" }, |
| 491 { "functionName": "recursive_b", "scriptId": 1, "url": "http
://xyz.abc.com/rec.js" }, | 496 { "functionName": "recursive_b", "scriptId": 1, "url": "http
://www.google.com/rec.js" }, |
| 492 { "functionName": "recursive_a", "scriptId": 1, "url": "http
://xyz.abc.com/rec.js" } | 497 { "functionName": "recursive_a", "scriptId": 1, "url": "http
://www.google.com/rec.js" } |
| 493 ] | 498 ] |
| 494 } | 499 } |
| 495 }, | 500 }, |
| 496 "cat": "disabled-by-default-devtools.timeline", | 501 "cat": "disabled-by-default-devtools.timeline", |
| 497 "name": "JSSample", | 502 "name": "JSSample", |
| 498 "ph": "I", | 503 "ph": "I", |
| 499 "pid": 17851, | 504 "pid": 17851, |
| 500 "tid": 23, | 505 "tid": 23, |
| 501 "ts": 253008 | 506 "ts": 253008 |
| 502 }, | 507 }, |
| 503 { | 508 { |
| 504 "args": { | 509 "args": { |
| 505 "data": { | 510 "data": { |
| 506 "stackTrace": [ | 511 "stackTrace": [ |
| 507 { "functionName": "recursive_b", "scriptId": 1, "url": "http
://xyz.abc.com/rec.js" }, | 512 { "functionName": "recursive_b", "scriptId": 1, "url": "http
://www.google.com/rec.js" }, |
| 508 { "functionName": "recursive_a", "scriptId": 1, "url": "http
://xyz.abc.com/rec.js" } | 513 { "functionName": "recursive_a", "scriptId": 1, "url": "http
://www.google.com/rec.js" } |
| 509 ] | 514 ] |
| 510 } | 515 } |
| 511 }, | 516 }, |
| 512 "cat": "disabled-by-default-devtools.timeline", | 517 "cat": "disabled-by-default-devtools.timeline", |
| 513 "name": "JSSample", | 518 "name": "JSSample", |
| 514 "ph": "I", | 519 "ph": "I", |
| 515 "pid": 17851, | 520 "pid": 17851, |
| 516 "tid": 23, | 521 "tid": 23, |
| 517 "ts": 253012 | 522 "ts": 253012 |
| 518 }, | 523 }, |
| 519 { | 524 { |
| 520 "args": { | 525 "args": { |
| 521 "data": { | 526 "data": { |
| 522 "stackTrace": [ | 527 "stackTrace": [ |
| 523 { "functionName": "recursive_a", "scriptId": 1, "url": "http
://xyz.abc.com/rec.js" } | 528 { "functionName": "recursive_a", "scriptId": 1, "url": "http
://www.google.com/rec.js" } |
| 524 ] | 529 ] |
| 525 } | 530 } |
| 526 }, | 531 }, |
| 527 "cat": "disabled-by-default-devtools.timeline", | 532 "cat": "disabled-by-default-devtools.timeline", |
| 528 "name": "JSSample", | 533 "name": "JSSample", |
| 529 "ph": "I", | 534 "ph": "I", |
| 530 "pid": 17851, | 535 "pid": 17851, |
| 531 "tid": 23, | 536 "tid": 23, |
| 532 "ts": 253014 | 537 "ts": 253014 |
| 533 }, | 538 }, |
| 534 { | 539 { |
| 535 "args": { | 540 "args": { |
| 536 "data": { | 541 "data": { |
| 537 "stackTrace": [ | 542 "stackTrace": [ |
| 538 ] | 543 ] |
| 539 } | 544 } |
| 540 }, | 545 }, |
| 541 "cat": "disabled-by-default-devtools.timeline", | 546 "cat": "disabled-by-default-devtools.timeline", |
| 542 "name": "JSSample", | 547 "name": "JSSample", |
| 543 "ph": "I", | 548 "ph": "I", |
| 544 "pid": 17851, | 549 "pid": 17851, |
| 545 "tid": 23, | 550 "tid": 23, |
| 546 "ts": 253015 | 551 "ts": 253015 |
| 547 }, | 552 }, |
| 548 { | 553 { |
| 549 "args": { | 554 "args": { |
| 550 "data": { | 555 "data": { |
| 551 "stackTrace": [ | 556 "stackTrace": [ |
| 552 { "functionName": "recursive_b", "scriptId": 1, "url": "http
://xyz.abc.com/rec.js" }, | 557 { "functionName": "recursive_b", "scriptId": 1, "url": "http
://www.google.com/rec.js" }, |
| 553 { "functionName": "recursive_a", "scriptId": 1, "url": "http
://xyz.abc.com/rec.js" } | 558 { "functionName": "recursive_a", "scriptId": 1, "url": "http
://www.google.com/rec.js" } |
| 554 ] | 559 ] |
| 555 } | 560 } |
| 556 }, | 561 }, |
| 557 "cat": "disabled-by-default-devtools.timeline", | 562 "cat": "disabled-by-default-devtools.timeline", |
| 558 "name": "JSSample", | 563 "name": "JSSample", |
| 559 "ph": "I", | 564 "ph": "I", |
| 560 "pid": 17851, | 565 "pid": 17851, |
| 561 "tid": 23, | 566 "tid": 23, |
| 562 "ts": 253100 | 567 "ts": 253100 |
| 563 }, | 568 }, |
| 564 { | 569 { |
| 565 "args": { | 570 "args": { |
| 566 "data": { | 571 "data": { |
| 567 "stackTrace": [ | 572 "stackTrace": [ |
| 568 { "functionName": "recursive_a", "scriptId": 1, "url": "http
://xyz.abc.com/rec.js" } | 573 { "functionName": "recursive_a", "scriptId": 1, "url": "http
://www.google.com/rec.js" } |
| 569 ] | 574 ] |
| 570 } | 575 } |
| 571 }, | 576 }, |
| 572 "cat": "disabled-by-default-devtools.timeline", | 577 "cat": "disabled-by-default-devtools.timeline", |
| 573 "name": "JSSample", | 578 "name": "JSSample", |
| 574 "ph": "I", | 579 "ph": "I", |
| 575 "pid": 17851, | 580 "pid": 17851, |
| 576 "tid": 23, | 581 "tid": 23, |
| 577 "ts": 253200 | 582 "ts": 253200 |
| 578 }, | 583 }, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 599 "tid": 23, | 604 "tid": 23, |
| 600 "ts": 500000, | 605 "ts": 500000, |
| 601 "tts": 5612506 | 606 "tts": 5612506 |
| 602 } | 607 } |
| 603 ]; | 608 ]; |
| 604 | 609 |
| 605 var timeline = UI.panels.timeline; | 610 var timeline = UI.panels.timeline; |
| 606 timeline._setModel(InspectorTest.createPerformanceModelWithEvents(rawTraceEv
ents)); | 611 timeline._setModel(InspectorTest.createPerformanceModelWithEvents(rawTraceEv
ents)); |
| 607 | 612 |
| 608 timeline.requestWindowTimes(0, Infinity); | 613 timeline.requestWindowTimes(0, Infinity); |
| 614 await ProductRegistry.instance(); |
| 609 var groupByEnum = Timeline.AggregatedTimelineTreeView.GroupBy; | 615 var groupByEnum = Timeline.AggregatedTimelineTreeView.GroupBy; |
| 610 for (var grouping in groupByEnum) { | 616 for (var grouping of Object.values(groupByEnum)) { |
| 611 var groupingValue = groupByEnum[grouping]; | 617 testEventTree("CallTree", grouping); |
| 612 testEventTree("CallTree", groupingValue); | 618 testEventTree("BottomUp", grouping); |
| 613 testEventTree("BottomUp", groupingValue); | |
| 614 } | 619 } |
| 615 | |
| 616 testEventTree("EventLog"); | 620 testEventTree("EventLog"); |
| 617 InspectorTest.completeTest(); | 621 InspectorTest.completeTest(); |
| 618 | 622 |
| 623 function getTreeView(type) |
| 624 { |
| 625 if (timeline._tabbedPane) { |
| 626 timeline._tabbedPane.selectTab(type, true); |
| 627 return timeline._currentView._treeView; |
| 628 } |
| 629 timeline._currentView._detailsView._tabbedPane.selectTab(type, true); |
| 630 return timeline._currentView._detailsView._tabbedPane.visibleView; |
| 631 } |
| 632 |
| 619 function testEventTree(type, grouping) | 633 function testEventTree(type, grouping) |
| 620 { | 634 { |
| 621 InspectorTest.addResult(""); | 635 InspectorTest.addResult(""); |
| 622 var tree; | 636 var tree = getTreeView(type); |
| 623 if (timeline._tabbedPane) { | |
| 624 timeline._tabbedPane.selectTab(type, true); | |
| 625 tree = timeline._currentView._treeView; | |
| 626 } else { | |
| 627 timeline._currentView._detailsView._tabbedPane.selectTab(type, true)
; | |
| 628 tree = timeline._currentView._detailsView._tabbedPane.visibleView; | |
| 629 } | |
| 630 if (grouping) { | 637 if (grouping) { |
| 631 InspectorTest.addResult(type + " Group by: " + grouping); | 638 InspectorTest.addResult(type + " Group by: " + grouping); |
| 632 tree._groupByCombobox.select(tree._groupByCombobox.options().find(x
=> x.value === grouping)); | 639 tree._groupBySetting.set(grouping); |
| 633 tree._onGroupByChanged(); | |
| 634 } else { | 640 } else { |
| 635 InspectorTest.addResult(type); | 641 InspectorTest.addResult(type); |
| 636 } | 642 } |
| 637 var rootNode = tree._dataGrid.rootNode(); | 643 var rootNode = tree._dataGrid.rootNode(); |
| 638 for (var node of rootNode.children) | 644 for (var node of rootNode.children) |
| 639 printEventTree(1, node._profileNode, node._treeView); | 645 printEventTree(1, node._profileNode, node._treeView); |
| 640 } | 646 } |
| 641 | 647 |
| 642 function printEventTree(padding, node, treeView) | 648 function printEventTree(padding, node, treeView) |
| 643 { | 649 { |
| 644 var name; | 650 var name; |
| 645 if (node.isGroupNode()) { | 651 if (node.isGroupNode()) { |
| 646 name = treeView._displayInfoForGroupNode(node).name; | 652 name = treeView._displayInfoForGroupNode(node).name; |
| 647 } else { | 653 } else { |
| 648 name = node.event.name === TimelineModel.TimelineModel.RecordType.JSF
rame | 654 name = node.event.name === TimelineModel.TimelineModel.RecordType.JS
Frame |
| 649 ? UI.beautifyFunctionName(node.event.args["data"]["functio
nName"]) | 655 ? UI.beautifyFunctionName(node.event.args["data"]["functio
nName"]) |
| 650 : Timeline.TimelineUIUtils.eventTitle(node.event); | 656 : Timeline.TimelineUIUtils.eventTitle(node.event); |
| 651 } | 657 } |
| 652 InspectorTest.addResult(" ".repeat(padding) + `${name}: ${node.selfTime
.toFixed(3)} ${node.totalTime.toFixed(3)}`); | 658 InspectorTest.addResult(" ".repeat(padding) + `${name}: ${node.selfTime
.toFixed(3)} ${node.totalTime.toFixed(3)}`); |
| 653 node.children().forEach(printEventTree.bind(null, padding + 1)); | 659 node.children().forEach(printEventTree.bind(null, padding + 1)); |
| 654 } | 660 } |
| 655 } | 661 } |
| 656 | 662 |
| 657 </script> | 663 </script> |
| 658 </head> | 664 </head> |
| 659 <body onload="runTest()"> | 665 <body onload="runTest()"> |
| 660 </body> | 666 </body> |
| 661 </html> | 667 </html> |
| OLD | NEW |