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

Side by Side Diff: Source/devtools/front_end/timeline/TimelineModel.js

Issue 1292943002: DevTools: Add total time column to the timeline tree view (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: addressing comment Created 5 years, 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 1543 matching lines...) Expand 10 before | Expand all | Expand 10 after
1554 } 1554 }
1555 1555
1556 /** 1556 /**
1557 * @param {!WebInspector.TimelineModel.ProfileTreeNode} topDownTree 1557 * @param {!WebInspector.TimelineModel.ProfileTreeNode} topDownTree
1558 * @param {function(!WebInspector.TimelineModel.ProfileTreeNode):?WebInspector.T imelineModel.ProfileTreeNode=} groupingCallback 1558 * @param {function(!WebInspector.TimelineModel.ProfileTreeNode):?WebInspector.T imelineModel.ProfileTreeNode=} groupingCallback
1559 * @return {!WebInspector.TimelineModel.ProfileTreeNode} 1559 * @return {!WebInspector.TimelineModel.ProfileTreeNode}
1560 */ 1560 */
1561 WebInspector.TimelineModel.buildBottomUpTree = function(topDownTree, groupingCal lback) 1561 WebInspector.TimelineModel.buildBottomUpTree = function(topDownTree, groupingCal lback)
1562 { 1562 {
1563 var buRoot = new WebInspector.TimelineModel.ProfileTreeNode(); 1563 var buRoot = new WebInspector.TimelineModel.ProfileTreeNode();
1564 buRoot.selfTime = 0;
1564 buRoot.totalTime = 0; 1565 buRoot.totalTime = 0;
1565 buRoot.name = WebInspector.UIString("Bottom-Up Chart"); 1566 buRoot.name = WebInspector.UIString("Bottom-Up Chart");
1566 /** @type {!Map<string,!WebInspector.TimelineModel.ProfileTreeNode>} */ 1567 /** @type {!Map<string,!WebInspector.TimelineModel.ProfileTreeNode>} */
1567 buRoot.children = new Map(); 1568 buRoot.children = new Map();
1568 processNode(topDownTree); 1569 processNode(topDownTree);
1569 1570
1570 /** 1571 /**
1571 * @param {!WebInspector.TimelineModel.ProfileTreeNode} tdNode 1572 * @param {!WebInspector.TimelineModel.ProfileTreeNode} tdNode
1572 */ 1573 */
1573 function processNode(tdNode) 1574 function processNode(tdNode)
1574 { 1575 {
1575 if (tdNode.selfTime > 0) { 1576 if (tdNode.selfTime > 0) {
1576 var buParent = groupingCallback && groupingCallback(tdNode) || buRoo t; 1577 var buParent = groupingCallback && groupingCallback(tdNode) || buRoo t;
1577 appendNode(tdNode, buParent); 1578 appendNode(tdNode, buParent);
1578 } 1579 }
1579 if (tdNode.children) 1580 if (tdNode.children)
1580 tdNode.children.forEach(processNode); 1581 tdNode.children.forEach(processNode);
1581 } 1582 }
1582 1583
1583 /** 1584 /**
1584 * @param {!WebInspector.TimelineModel.ProfileTreeNode} tdNode 1585 * @param {!WebInspector.TimelineModel.ProfileTreeNode} tdNode
1585 * @param {!WebInspector.TimelineModel.ProfileTreeNode} buParent 1586 * @param {!WebInspector.TimelineModel.ProfileTreeNode} buParent
1586 */ 1587 */
1587 function appendNode(tdNode, buParent) 1588 function appendNode(tdNode, buParent)
1588 { 1589 {
1589 var time = tdNode.selfTime; 1590 var selfTime = tdNode.selfTime;
1590 buParent.totalTime += time; 1591 var totalTime = tdNode.totalTime;
1592 buParent.selfTime += selfTime;
1593 buParent.totalTime += selfTime;
1591 while (tdNode.parent) { 1594 while (tdNode.parent) {
1592 if (!buParent.children) 1595 if (!buParent.children)
1593 buParent.children = /** @type {!Map<string,!WebInspector.Timelin eModel.ProfileTreeNode>} */ (new Map()); 1596 buParent.children = /** @type {!Map<string,!WebInspector.Timelin eModel.ProfileTreeNode>} */ (new Map());
1594 var id = tdNode.id; 1597 var id = tdNode.id;
1595 var buNode = buParent.children.get(id); 1598 var buNode = buParent.children.get(id);
1596 if (!buNode) { 1599 if (!buNode) {
1597 buNode = new WebInspector.TimelineModel.ProfileTreeNode(); 1600 buNode = new WebInspector.TimelineModel.ProfileTreeNode();
1598 buNode.totalTime = time; 1601 buNode.selfTime = selfTime;
1602 buNode.totalTime = totalTime;
1599 buNode.name = tdNode.name; 1603 buNode.name = tdNode.name;
1600 buNode.event = tdNode.event; 1604 buNode.event = tdNode.event;
1601 buNode.id = id; 1605 buNode.id = id;
1602 buParent.children.set(id, buNode); 1606 buParent.children.set(id, buNode);
1603 } else { 1607 } else {
1604 buNode.totalTime += time; 1608 buNode.selfTime += selfTime;
1609 buNode.totalTime += totalTime;
1605 } 1610 }
1606 tdNode = tdNode.parent; 1611 tdNode = tdNode.parent;
1607 buParent = buNode; 1612 buParent = buNode;
1608 } 1613 }
1609 } 1614 }
1610 1615
1611 return buRoot; 1616 return buRoot;
1612 } 1617 }
1613 1618
1614 /** 1619 /**
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after
2335 /** @type {!Object.<string, !Array.<!WebInspector.InvalidationTrackingEv ent>>} */ 2340 /** @type {!Object.<string, !Array.<!WebInspector.InvalidationTrackingEv ent>>} */
2336 this._invalidations = {}; 2341 this._invalidations = {};
2337 /** @type {!Object.<number, !Array.<!WebInspector.InvalidationTrackingEv ent>>} */ 2342 /** @type {!Object.<number, !Array.<!WebInspector.InvalidationTrackingEv ent>>} */
2338 this._invalidationsByNodeId = {}; 2343 this._invalidationsByNodeId = {};
2339 2344
2340 this._lastRecalcStyle = undefined; 2345 this._lastRecalcStyle = undefined;
2341 this._lastPaintWithLayer = undefined; 2346 this._lastPaintWithLayer = undefined;
2342 this._didPaint = false; 2347 this._didPaint = false;
2343 } 2348 }
2344 } 2349 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698