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

Side by Side Diff: tools/profview/profview.js

Issue 2730293002: [profiler] This adds function butterflies to the function list. (Closed)
Patch Set: Formatting Created 3 years, 9 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
« no previous file with comments | « tools/profview/profview.css ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 the V8 project authors. All rights reserved. 1 // Copyright 2017 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 "use strict" 5 "use strict"
6 6
7 function $(id) { 7 function $(id) {
8 return document.getElementById(id); 8 return document.getElementById(id);
9 } 9 }
10 10
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 callTreeState.categories = "code-type"; 76 callTreeState.categories = "code-type";
77 callTreeState.sort = "time"; 77 callTreeState.sort = "time";
78 break; 78 break;
79 case "top-down": 79 case "top-down":
80 callTreeState.attribution = "js-exclude-bc"; 80 callTreeState.attribution = "js-exclude-bc";
81 callTreeState.categories = "none"; 81 callTreeState.categories = "none";
82 callTreeState.sort = "time"; 82 callTreeState.sort = "time";
83 break; 83 break;
84 case "function-list": 84 case "function-list":
85 callTreeState.attribution = "js-exclude-bc"; 85 callTreeState.attribution = "js-exclude-bc";
86 callTreeState.categories = "none"; 86 callTreeState.categories = "code-type";
87 callTreeState.sort = "own-time"; 87 callTreeState.sort = "own-time";
88 break; 88 break;
89 default: 89 default:
90 console.error("Invalid mode"); 90 console.error("Invalid mode");
91 } 91 }
92 main.currentState = setCallTreeState(main.currentState, callTreeState); 92 main.currentState = setCallTreeState(main.currentState, callTreeState);
93 main.delayRender(); 93 main.delayRender();
94 } 94 }
95 }, 95 },
96 96
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 return (type, kind) => type !== 'CODE'; 272 return (type, kind) => type !== 'CODE';
273 case "js-exclude-bc": 273 case "js-exclude-bc":
274 return (type, kind) => 274 return (type, kind) =>
275 type !== 'CODE' || !CallTreeView.IsBytecodeHandler(kind); 275 type !== 'CODE' || !CallTreeView.IsBytecodeHandler(kind);
276 } 276 }
277 } 277 }
278 278
279 sortFromId(id) { 279 sortFromId(id) {
280 switch (id) { 280 switch (id) {
281 case "time": 281 case "time":
282 return (c1, c2) => c2.ticks - c1.ticks; 282 return (c1, c2) => {
283 if (c1.ticks < c2.ticks) return 1;
284 else if (c1.ticks > c2.ticks) return -1;
285 return c2.ownTicks - c1.ownTicks;
286 }
283 case "own-time": 287 case "own-time":
284 return (c1, c2) => c2.ownTicks - c1.ownTicks; 288 return (c1, c2) => {
289 if (c1.ownTicks < c2.ownTicks) return 1;
290 else if (c1.ownTicks > c2.ownTicks) return -1;
291 return c2.ticks - c1.ticks;
292 }
285 case "category-time": 293 case "category-time":
286 return (c1, c2) => { 294 return (c1, c2) => {
287 if (c1.type === c2.type) return c2.ticks - c1.ticks; 295 if (c1.type === c2.type) return c2.ticks - c1.ticks;
288 if (c1.type < c2.type) return 1; 296 if (c1.type < c2.type) return 1;
289 return -1; 297 return -1;
290 }; 298 };
291 case "category-own-time": 299 case "category-own-time":
292 return (c1, c2) => { 300 return (c1, c2) => {
293 if (c1.type === c2.type) return c2.ownTicks - c1.ownTicks; 301 if (c1.type === c2.type) return c2.ownTicks - c1.ownTicks;
294 if (c1.type < c2.type) return 1; 302 if (c1.type < c2.type) return 1;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 // again. 384 // again.
377 expander.textContent = "\u25BE"; 385 expander.textContent = "\u25BE";
378 let expandHandler = expander.onclick; 386 let expandHandler = expander.onclick;
379 expander.onclick = () => { 387 expander.onclick = () => {
380 that.collapseRow(tree, expander, expandHandler); 388 that.collapseRow(tree, expander, expandHandler);
381 } 389 }
382 } 390 }
383 391
384 // Collect the children, and sort them by ticks. 392 // Collect the children, and sort them by ticks.
385 let children = []; 393 let children = [];
386 for (let child in tree.children) { 394 let filter =
387 if (tree.children[child].ticks > 0) { 395 this.filterFromFilterId(this.currentState.callTree.attribution);
388 children.push(tree.children[child]); 396 for (let childId in tree.children) {
397 let child = tree.children[childId];
398 if (child.ticks > 0) {
399 children.push(child);
400 if (child.delayedExpansion) {
401 expandTreeNode(this.currentState.file, child, filter);
402 }
389 } 403 }
390 } 404 }
391 children.sort(this.sortFromId(this.currentState.callTree.sort)); 405 children.sort(this.sortFromId(this.currentState.callTree.sort));
392 406
393 for (let i = 0; i < children.length; i++) { 407 for (let i = 0; i < children.length; i++) {
394 let node = children[i]; 408 let node = children[i];
395 let row = this.rows.insertRow(index); 409 let row = this.rows.insertRow(index);
396 row.id = id + i + "/"; 410 row.id = id + i + "/";
397 411
398 if (node.type != "CAT") { 412 if (node.type != "CAT") {
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 addOptions(this.selectSort, [ 513 addOptions(this.selectSort, [
500 { value : "time", text : "Time (including children)" }, 514 { value : "time", text : "Time (including children)" },
501 { value : "own-time", text : "Own time" }, 515 { value : "own-time", text : "Own time" },
502 { value : "category-time", text : "Code category, time" }, 516 { value : "category-time", text : "Code category, time" },
503 { value : "category-own-time", text : "Code category, own time"} 517 { value : "category-own-time", text : "Code category, own time"}
504 ], calltree.sort); 518 ], calltree.sort);
505 return; 519 return;
506 case "function-list": 520 case "function-list":
507 addOptions(this.selectAttribution, attributions, calltree.attribution); 521 addOptions(this.selectAttribution, attributions, calltree.attribution);
508 addOptions(this.selectCategories, [ 522 addOptions(this.selectCategories, [
523 { value : "code-type", text : "Code type" },
509 { value : "none", text : "None" } 524 { value : "none", text : "None" }
510 ], calltree.categories); 525 ], calltree.categories);
511 addOptions(this.selectSort, [ 526 addOptions(this.selectSort, [
512 { value : "own-time", text : "Own time" }, 527 { value : "own-time", text : "Own time" },
513 { value : "time", text : "Time (including children)" }, 528 { value : "time", text : "Time (including children)" },
514 { value : "category-own-time", text : "Code category, own time"}, 529 { value : "category-own-time", text : "Code category, own time"},
515 { value : "category-time", text : "Code category, time" }, 530 { value : "category-time", text : "Code category, time" },
516 ], calltree.sort); 531 ], calltree.sort);
517 return; 532 return;
518 } 533 }
(...skipping 24 matching lines...) Expand all
543 this.element.style.display = "inherit"; 558 this.element.style.display = "inherit";
544 559
545 let mode = this.currentState.callTree.mode; 560 let mode = this.currentState.callTree.mode;
546 if (!oldState || mode !== oldState.callTree.mode) { 561 if (!oldState || mode !== oldState.callTree.mode) {
547 // Technically, we should also call this if attribution, categories or 562 // Technically, we should also call this if attribution, categories or
548 // sort change, but the selection is already highlighted by the combobox 563 // sort change, but the selection is already highlighted by the combobox
549 // itself, so we do need to do anything here. 564 // itself, so we do need to do anything here.
550 this.fillSelects(newState.callTree); 565 this.fillSelects(newState.callTree);
551 } 566 }
552 567
553 let inclusiveDisplay = (mode === "bottom-up") ? "none" : "inherit"; 568 let ownTimeClass = (mode === "bottom-up") ? "numeric-hidden" : "numeric";
554 let ownTimeTh = $(this.treeElement.id + "-own-time-header"); 569 let ownTimeTh = $(this.treeElement.id + "-own-time-header");
555 ownTimeTh.style.display = inclusiveDisplay; 570 ownTimeTh.classList = ownTimeClass;
556 let ownTicksTh = $(this.treeElement.id + "-own-ticks-header"); 571 let ownTicksTh = $(this.treeElement.id + "-own-ticks-header");
557 ownTicksTh.style.display = inclusiveDisplay; 572 ownTicksTh.classList = ownTimeClass;
558 573
559 // Build the tree. 574 // Build the tree.
560 let stackProcessor; 575 let stackProcessor;
561 let filter = this.filterFromFilterId(this.currentState.callTree.attribution) ; 576 let filter = this.filterFromFilterId(this.currentState.callTree.attribution) ;
562 if (mode === "top-down") { 577 if (mode === "top-down") {
563 stackProcessor = 578 stackProcessor =
564 new PlainCallTreeProcessor(filter, false); 579 new PlainCallTreeProcessor(filter, false);
565 } else if (mode === "function-list") { 580 } else if (mode === "function-list") {
566 stackProcessor = 581 stackProcessor = new FunctionListTree(
567 new FunctionListTree(filter); 582 filter, this.currentState.callTree.categories === "code-type");
568 583
569 } else { 584 } else {
570 console.assert(mode === "bottom-up"); 585 console.assert(mode === "bottom-up");
571 if (this.currentState.callTree.categories == "none") { 586 if (this.currentState.callTree.categories == "none") {
572 stackProcessor = 587 stackProcessor =
573 new PlainCallTreeProcessor(filter, true); 588 new PlainCallTreeProcessor(filter, true);
574 } else { 589 } else {
575 console.assert(this.currentState.callTree.categories === "code-type"); 590 console.assert(this.currentState.callTree.categories === "code-type");
576 stackProcessor = 591 stackProcessor =
577 new CategorizedCallTreeProcessor(filter, true); 592 new CategorizedCallTreeProcessor(filter, true);
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
803 818
804 class HelpView { 819 class HelpView {
805 constructor() { 820 constructor() {
806 this.element = $("help"); 821 this.element = $("help");
807 } 822 }
808 823
809 render(newState) { 824 render(newState) {
810 this.element.style.display = newState.file ? "none" : "inherit"; 825 this.element.style.display = newState.file ? "none" : "inherit";
811 } 826 }
812 } 827 }
OLDNEW
« no previous file with comments | « tools/profview/profview.css ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698