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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/timeline_model/TimelineProfileTree.js

Issue 2486923005: Timeline: add moar attributes in frame instrumentation (Closed)
Patch Set: rebased Created 4 years, 1 month 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 | « third_party/WebKit/Source/devtools/front_end/timeline_model/TimelineModel.js ('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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium 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 WebInspector.TimelineProfileTree = {}; 4 WebInspector.TimelineProfileTree = {};
5 5
6 /** 6 /**
7 * @unrestricted 7 * @unrestricted
8 */ 8 */
9 WebInspector.TimelineProfileTree.Node = class { 9 WebInspector.TimelineProfileTree.Node = class {
10 constructor() { 10 constructor() {
(...skipping 21 matching lines...) Expand all
32 isGroupNode() { 32 isGroupNode() {
33 return this._isGroupNode; 33 return this._isGroupNode;
34 } 34 }
35 }; 35 };
36 36
37 /** 37 /**
38 * @param {!Array<!WebInspector.TracingModel.Event>} events 38 * @param {!Array<!WebInspector.TracingModel.Event>} events
39 * @param {!Array<!WebInspector.TimelineModel.Filter>} filters 39 * @param {!Array<!WebInspector.TimelineModel.Filter>} filters
40 * @param {number} startTime 40 * @param {number} startTime
41 * @param {number} endTime 41 * @param {number} endTime
42 * @param {function(!WebInspector.TracingModel.Event, string):string=} eventGrou pIdCallback 42 * @param {function(!WebInspector.TracingModel.Event):string=} eventGroupIdCallb ack
43 * @return {!WebInspector.TimelineProfileTree.Node} 43 * @return {!WebInspector.TimelineProfileTree.Node}
44 */ 44 */
45 WebInspector.TimelineProfileTree.buildTopDown = function(events, filters, startT ime, endTime, eventGroupIdCallback) { 45 WebInspector.TimelineProfileTree.buildTopDown = function(events, filters, startT ime, endTime, eventGroupIdCallback) {
46 // Temporarily deposit a big enough value that exceeds the max recording time. 46 // Temporarily deposit a big enough value that exceeds the max recording time.
47 var /** @const */ initialTime = 1e7; 47 var /** @const */ initialTime = 1e7;
48 var root = new WebInspector.TimelineProfileTree.Node(); 48 var root = new WebInspector.TimelineProfileTree.Node();
49 root.totalTime = initialTime; 49 root.totalTime = initialTime;
50 root.selfTime = initialTime; 50 root.selfTime = initialTime;
51 root.children = /** @type {!Map<string, !WebInspector.TimelineProfileTree.Node >} */ (new Map()); 51 root.children = /** @type {!Map<string, !WebInspector.TimelineProfileTree.Node >} */ (new Map());
52 var pageFrameIdStack = [];
53 var parent = root; 52 var parent = root;
54 53
55 /** 54 /**
56 * @param {!WebInspector.TracingModel.Event} e 55 * @param {!WebInspector.TracingModel.Event} e
57 */ 56 */
58 function onStartEvent(e) { 57 function onStartEvent(e) {
59 var pageFrameId = WebInspector.TimelineModel.eventFrameId(e) || pageFrameIdS tack.peekLast();
60 pageFrameIdStack.push(pageFrameId);
61 if (!WebInspector.TimelineModel.isVisible(filters, e)) 58 if (!WebInspector.TimelineModel.isVisible(filters, e))
62 return; 59 return;
63 var time = e.endTime ? Math.min(endTime, e.endTime) - Math.max(startTime, e. startTime) : 0; 60 var time = e.endTime ? Math.min(endTime, e.endTime) - Math.max(startTime, e. startTime) : 0;
64 var groupId = eventGroupIdCallback ? eventGroupIdCallback(e, pageFrameId) : Symbol('uniqueGroupId'); 61 var groupId = eventGroupIdCallback ? eventGroupIdCallback(e) : Symbol('uniqu eGroupId');
65 var id = eventGroupIdCallback ? WebInspector.TimelineProfileTree._eventId(e) : Symbol('uniqueEventId'); 62 var id = eventGroupIdCallback ? WebInspector.TimelineProfileTree._eventId(e) : Symbol('uniqueEventId');
66 if (typeof groupId === 'string' && typeof id === 'string') 63 if (typeof groupId === 'string' && typeof id === 'string')
67 id += '/' + groupId; 64 id += '/' + groupId;
68 if (!parent.children) 65 if (!parent.children)
69 parent.children = /** @type {!Map<string,!WebInspector.TimelineProfileTree .Node>} */ (new Map()); 66 parent.children = /** @type {!Map<string,!WebInspector.TimelineProfileTree .Node>} */ (new Map());
70 var node = parent.children.get(id); 67 var node = parent.children.get(id);
71 if (node) { 68 if (node) {
72 node.selfTime += time; 69 node.selfTime += time;
73 node.totalTime += time; 70 node.totalTime += time;
74 } else { 71 } else {
(...skipping 12 matching lines...) Expand all
87 parent.selfTime = 0; 84 parent.selfTime = 0;
88 } 85 }
89 if (e.endTime) 86 if (e.endTime)
90 parent = node; 87 parent = node;
91 } 88 }
92 89
93 /** 90 /**
94 * @param {!WebInspector.TracingModel.Event} e 91 * @param {!WebInspector.TracingModel.Event} e
95 */ 92 */
96 function onEndEvent(e) { 93 function onEndEvent(e) {
97 pageFrameIdStack.pop();
98 if (!WebInspector.TimelineModel.isVisible(filters, e)) 94 if (!WebInspector.TimelineModel.isVisible(filters, e))
99 return; 95 return;
100 parent = parent.parent; 96 parent = parent.parent;
101 } 97 }
102 98
103 var instantEventCallback = eventGroupIdCallback ? undefined : onStartEvent; / / Ignore instant events when aggregating. 99 var instantEventCallback = eventGroupIdCallback ? undefined : onStartEvent; / / Ignore instant events when aggregating.
104 WebInspector.TimelineModel.forEachEvent(events, onStartEvent, onEndEvent, inst antEventCallback, startTime, endTime); 100 WebInspector.TimelineModel.forEachEvent(events, onStartEvent, onEndEvent, inst antEventCallback, startTime, endTime);
105 root.totalTime -= root.selfTime; 101 root.totalTime -= root.selfTime;
106 root.selfTime = 0; 102 root.selfTime = 0;
107 return root; 103 return root;
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 groupNode.totalTime = 0; 269 groupNode.totalTime = 0;
274 groupNode.children = new Map(); 270 groupNode.children = new Map();
275 groupNode.event = event; 271 groupNode.event = event;
276 groupNode._isGroupNode = true; 272 groupNode._isGroupNode = true;
277 this._groupNodes.set(id, groupNode); 273 this._groupNodes.set(id, groupNode);
278 return groupNode; 274 return groupNode;
279 } 275 }
280 }; 276 };
281 277
282 WebInspector.TimelineAggregator._groupNodeFlag = Symbol('groupNode'); 278 WebInspector.TimelineAggregator._groupNodeFlag = Symbol('groupNode');
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/timeline_model/TimelineModel.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698