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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/timeline/TimelineFlameChart.js

Issue 2517463005: Timeline: nuke flow events experiment (Closed)
Patch Set: also removed flow events support from FlameChart 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 /** 152 /**
153 * @override 153 * @override
154 * @return {!UI.FlameChart.TimelineData} 154 * @return {!UI.FlameChart.TimelineData}
155 */ 155 */
156 timelineData() { 156 timelineData() {
157 if (this._timelineData) 157 if (this._timelineData)
158 return this._timelineData; 158 return this._timelineData;
159 159
160 this._timelineData = new UI.FlameChart.TimelineData([], [], [], []); 160 this._timelineData = new UI.FlameChart.TimelineData([], [], [], []);
161 161
162 this._flowEventIndexById = {};
163 this._minimumBoundary = this._model.minimumRecordTime(); 162 this._minimumBoundary = this._model.minimumRecordTime();
164 this._timeSpan = this._model.isEmpty() ? 1000 : this._model.maximumRecordTim e() - this._minimumBoundary; 163 this._timeSpan = this._model.isEmpty() ? 1000 : this._model.maximumRecordTim e() - this._minimumBoundary;
165 this._currentLevel = 0; 164 this._currentLevel = 0;
166 this._appendFrameBars(this._frameModel.frames()); 165 this._appendFrameBars(this._frameModel.frames());
167 166
168 this._appendHeader(Common.UIString('Interactions'), this._interactionsHeader Level1); 167 this._appendHeader(Common.UIString('Interactions'), this._interactionsHeader Level1);
169 this._appendInteractionRecords(); 168 this._appendInteractionRecords();
170 169
171 var asyncEventGroups = TimelineModel.TimelineModel.AsyncEventGroup; 170 var asyncEventGroups = TimelineModel.TimelineModel.AsyncEventGroup;
172 var inputLatencies = this._model.mainThreadAsyncEvents().get(asyncEventGroup s.input); 171 var inputLatencies = this._model.mainThreadAsyncEvents().get(asyncEventGroup s.input);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 * @param {!Timeline.TimelineFlameChartMarker} a 209 * @param {!Timeline.TimelineFlameChartMarker} a
211 * @param {!Timeline.TimelineFlameChartMarker} b 210 * @param {!Timeline.TimelineFlameChartMarker} b
212 */ 211 */
213 function compareStartTime(a, b) { 212 function compareStartTime(a, b) {
214 return a.startTime() - b.startTime(); 213 return a.startTime() - b.startTime();
215 } 214 }
216 215
217 this._markers.sort(compareStartTime); 216 this._markers.sort(compareStartTime);
218 this._timelineData.markers = this._markers; 217 this._timelineData.markers = this._markers;
219 218
220 this._flowEventIndexById = {};
221 return this._timelineData; 219 return this._timelineData;
222 } 220 }
223 221
224 /** 222 /**
225 * @param {number} level 223 * @param {number} level
226 * @param {!TimelineModel.TimelineModel.PageFrame} frame 224 * @param {!TimelineModel.TimelineModel.PageFrame} frame
227 */ 225 */
228 _appendFrameEvents(level, frame) { 226 _appendFrameEvents(level, frame) {
229 var events = this._model.eventsForFrame(frame.id); 227 var events = this._model.eventsForFrame(frame.id);
230 var clonedHeader = Object.assign({}, this._headerLevel1); 228 var clonedHeader = Object.assign({}, this._headerLevel1);
(...skipping 16 matching lines...) Expand all
247 } 245 }
248 246
249 /** 247 /**
250 * @param {!Array<!SDK.TracingModel.Event>} events 248 * @param {!Array<!SDK.TracingModel.Event>} events
251 * @param {string} title 249 * @param {string} title
252 * @param {!UI.FlameChart.GroupStyle} style 250 * @param {!UI.FlameChart.GroupStyle} style
253 * @param {boolean=} forceExpanded 251 * @param {boolean=} forceExpanded
254 */ 252 */
255 _appendSyncEvents(events, title, style, forceExpanded) { 253 _appendSyncEvents(events, title, style, forceExpanded) {
256 var openEvents = []; 254 var openEvents = [];
257 var flowEventsEnabled = Runtime.experiments.isEnabled('timelineFlowEvents');
258 var blackboxingEnabled = Runtime.experiments.isEnabled('blackboxJSFramesOnTi meline'); 255 var blackboxingEnabled = Runtime.experiments.isEnabled('blackboxJSFramesOnTi meline');
259 var maxStackDepth = 0; 256 var maxStackDepth = 0;
260 for (var i = 0; i < events.length; ++i) { 257 for (var i = 0; i < events.length; ++i) {
261 var e = events[i]; 258 var e = events[i];
262 if (TimelineModel.TimelineModel.isMarkerEvent(e)) { 259 if (TimelineModel.TimelineModel.isMarkerEvent(e)) {
263 this._markers.push(new Timeline.TimelineFlameChartMarker( 260 this._markers.push(new Timeline.TimelineFlameChartMarker(
264 e.startTime, e.startTime - this._model.minimumRecordTime(), 261 e.startTime, e.startTime - this._model.minimumRecordTime(),
265 Timeline.TimelineUIUtils.markerStyleForEvent(e))); 262 Timeline.TimelineUIUtils.markerStyleForEvent(e)));
266 } 263 }
267 if (!SDK.TracingModel.isFlowPhase(e.phase)) { 264 if (!SDK.TracingModel.isFlowPhase(e.phase)) {
(...skipping 13 matching lines...) Expand all
281 continue; 278 continue;
282 e._blackboxRoot = true; 279 e._blackboxRoot = true;
283 } 280 }
284 if (title) { 281 if (title) {
285 this._appendHeader(title, style, forceExpanded); 282 this._appendHeader(title, style, forceExpanded);
286 title = ''; 283 title = '';
287 } 284 }
288 285
289 var level = this._currentLevel + openEvents.length; 286 var level = this._currentLevel + openEvents.length;
290 this._appendEvent(e, level); 287 this._appendEvent(e, level);
291 if (flowEventsEnabled)
292 this._appendFlowEvent(e, level);
293 maxStackDepth = Math.max(maxStackDepth, openEvents.length + 1); 288 maxStackDepth = Math.max(maxStackDepth, openEvents.length + 1);
294 if (e.endTime) 289 if (e.endTime)
295 openEvents.push(e); 290 openEvents.push(e);
296 } 291 }
297 this._entryTypeByLevel.length = this._currentLevel + maxStackDepth; 292 this._entryTypeByLevel.length = this._currentLevel + maxStackDepth;
298 this._entryTypeByLevel.fill(Timeline.TimelineFlameChartEntryType.Event, this ._currentLevel); 293 this._entryTypeByLevel.fill(Timeline.TimelineFlameChartEntryType.Event, this ._currentLevel);
299 this._currentLevel += maxStackDepth; 294 this._currentLevel += maxStackDepth;
300 } 295 }
301 296
302 /** 297 /**
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 var duration; 595 var duration;
601 if (TimelineModel.TimelineModel.isMarkerEvent(event)) 596 if (TimelineModel.TimelineModel.isMarkerEvent(event))
602 duration = undefined; 597 duration = undefined;
603 else 598 else
604 duration = event.duration || Timeline.TimelineFlameChartDataProvider.Insta ntEventVisibleDurationMs; 599 duration = event.duration || Timeline.TimelineFlameChartDataProvider.Insta ntEventVisibleDurationMs;
605 this._timelineData.entryTotalTimes[index] = duration; 600 this._timelineData.entryTotalTimes[index] = duration;
606 this._timelineData.entryStartTimes[index] = event.startTime; 601 this._timelineData.entryStartTimes[index] = event.startTime;
607 } 602 }
608 603
609 /** 604 /**
610 * @param {!SDK.TracingModel.Event} event
611 * @param {number} level
612 */
613 _appendFlowEvent(event, level) {
614 var timelineData = this._timelineData;
615 /**
616 * @param {!SDK.TracingModel.Event} event
617 * @return {number}
618 */
619 function pushStartFlow(event) {
620 var flowIndex = timelineData.flowStartTimes.length;
621 timelineData.flowStartTimes.push(event.startTime);
622 timelineData.flowStartLevels.push(level);
623 return flowIndex;
624 }
625
626 /**
627 * @param {!SDK.TracingModel.Event} event
628 * @param {number} flowIndex
629 */
630 function pushEndFlow(event, flowIndex) {
631 timelineData.flowEndTimes[flowIndex] = event.startTime;
632 timelineData.flowEndLevels[flowIndex] = level;
633 }
634
635 switch (event.phase) {
636 case SDK.TracingModel.Phase.FlowBegin:
637 this._flowEventIndexById[event.id] = pushStartFlow(event);
638 break;
639 case SDK.TracingModel.Phase.FlowStep:
640 pushEndFlow(event, this._flowEventIndexById[event.id]);
641 this._flowEventIndexById[event.id] = pushStartFlow(event);
642 break;
643 case SDK.TracingModel.Phase.FlowEnd:
644 pushEndFlow(event, this._flowEventIndexById[event.id]);
645 delete this._flowEventIndexById[event.id];
646 break;
647 }
648 }
649
650 /**
651 * @param {!SDK.TracingModel.AsyncEvent} asyncEvent 605 * @param {!SDK.TracingModel.AsyncEvent} asyncEvent
652 * @param {number} level 606 * @param {number} level
653 */ 607 */
654 _appendAsyncEvent(asyncEvent, level) { 608 _appendAsyncEvent(asyncEvent, level) {
655 if (SDK.TracingModel.isNestableAsyncPhase(asyncEvent.phase)) { 609 if (SDK.TracingModel.isNestableAsyncPhase(asyncEvent.phase)) {
656 // FIXME: also add steps once we support event nesting in the FlameChart. 610 // FIXME: also add steps once we support event nesting in the FlameChart.
657 this._appendEvent(asyncEvent, level); 611 this._appendEvent(asyncEvent, level);
658 return; 612 return;
659 } 613 }
660 var steps = asyncEvent.steps; 614 var steps = asyncEvent.steps;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 * @param {!SDK.TracingModel.Event} event 690 * @param {!SDK.TracingModel.Event} event
737 * @return {?Timeline.TimelineSelection} selection 691 * @return {?Timeline.TimelineSelection} selection
738 */ 692 */
739 selectionForEvent(event) { 693 selectionForEvent(event) {
740 var entryIndex = this._entryData.indexOf(event); 694 var entryIndex = this._entryData.indexOf(event);
741 return this.createSelection(entryIndex); 695 return this.createSelection(entryIndex);
742 } 696 }
743 }; 697 };
744 698
745 Timeline.TimelineFlameChartDataProvider.InstantEventVisibleDurationMs = 0.001; 699 Timeline.TimelineFlameChartDataProvider.InstantEventVisibleDurationMs = 0.001;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698