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

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

Issue 402113002: Draw marker events on Timeline flame chart (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 /** 109 /**
110 * @param {number} startTime 110 * @param {number} startTime
111 * @param {number} endTime 111 * @param {number} endTime
112 * @return {?Array.<number>} 112 * @return {?Array.<number>}
113 */ 113 */
114 dividerOffsets: function(startTime, endTime) 114 dividerOffsets: function(startTime, endTime)
115 { 115 {
116 return null; 116 return null;
117 }, 117 },
118 118
119 /**
120 * @param {number} index
alph 2014/07/21 14:21:07 @override
yurys 2014/07/21 14:30:00 Done.
121 * @return {string}
122 */
123 markerColor: function(index)
124 {
125 var event = this._markerEvents[index];
126 return WebInspector.TimelineUIUtilsImpl.markerEventColor(event.name);
127 },
128
129 /**
130 * @param {number} index
alph 2014/07/21 14:21:07 ditto
yurys 2014/07/21 14:30:00 Done.
131 * @return {string}
132 */
133 markerTitle: function(index)
134 {
135 var event = this._markerEvents[index];
136 return WebInspector.TracingTimelineUIUtils.eventTitle(event, this._model );
137 },
138
119 reset: function() 139 reset: function()
120 { 140 {
121 this._timelineData = null; 141 this._timelineData = null;
122 /** @type {!Array.<!WebInspector.TracingModel.Event>} */ 142 /** @type {!Array.<!WebInspector.TracingModel.Event>} */
123 this._entryEvents = []; 143 this._entryEvents = [];
124 this._entryIndexToTitle = {}; 144 this._entryIndexToTitle = {};
145 this._markerEvents = [];
125 }, 146 },
126 147
127 /** 148 /**
128 * @return {!WebInspector.FlameChart.TimelineData} 149 * @return {!WebInspector.FlameChart.TimelineData}
129 */ 150 */
130 timelineData: function() 151 timelineData: function()
131 { 152 {
132 if (this._timelineData) 153 if (this._timelineData)
133 return this._timelineData; 154 return this._timelineData;
134 155
135 /** 156 this._timelineData = new WebInspector.FlameChart.TimelineData([], [], [] );
136 * @type {?WebInspector.FlameChart.TimelineData}
137 */
138 this._timelineData = {
139 entryLevels: [],
140 entryTotalTimes: [],
141 entryStartTimes: []
142 };
143 157
144 this._minimumBoundary = this._model.minimumRecordTime(); 158 this._minimumBoundary = this._model.minimumRecordTime();
145 this._timeSpan = Math.max(this._model.maximumRecordTime() - this._minimu mBoundary, 1000); 159 this._timeSpan = Math.max(this._model.maximumRecordTime() - this._minimu mBoundary, 1000);
146 this._currentLevel = 0; 160 this._currentLevel = 0;
147 this._appendThreadTimelineData(WebInspector.UIString("Main Thread"), thi s._model.mainThreadEvents()); 161 this._appendThreadTimelineData(WebInspector.UIString("Main Thread"), thi s._model.mainThreadEvents());
148 var threads = this._model.virtualThreads(); 162 var threads = this._model.virtualThreads();
149 for (var threadName in threads) { 163 for (var threadName in threads) {
150 if (threadName !== WebInspector.TimelineModel.MainThreadName) 164 if (threadName !== WebInspector.TimelineModel.MainThreadName)
151 this._appendThreadTimelineData(threadName, threads[threadName]); 165 this._appendThreadTimelineData(threadName, threads[threadName]);
152 } 166 }
153 return this._timelineData; 167 return this._timelineData;
154 }, 168 },
155 169
156 /** 170 /**
157 * @param {string} headerName 171 * @param {string} headerName
158 * @param {!Array.<!WebInspector.TracingModel.Event>} events 172 * @param {!Array.<!WebInspector.TracingModel.Event>} events
159 */ 173 */
160 _appendThreadTimelineData: function(headerName, events) 174 _appendThreadTimelineData: function(headerName, events)
161 { 175 {
162 var maxStackDepth = 0; 176 var maxStackDepth = 0;
163 var openEvents = []; 177 var openEvents = [];
164 var levels = []; 178 var levels = [];
165 var jsHeights = []; 179 var jsHeights = [];
166 var headerAppended = false; 180 var headerAppended = false;
167 var level = 0; 181 var level = 0;
168 var jsStackHeight = 0; 182 var jsStackHeight = 0;
169 for (var i = 0; i < events.length; ++i) { 183 for (var i = 0; i < events.length; ++i) {
170 var e = events[i]; 184 var e = events[i];
171 if (!e.endTime && e.phase !== WebInspector.TracingModel.Phase.Instan t) 185 // FIXME: clean up once phase name is unified between Blink and Chro mium.
186 if (!e.endTime && e.phase !== WebInspector.TracingModel.Phase.Instan t && e.phase !== "I")
172 continue; 187 continue;
188 if (WebInspector.TracingTimelineUIUtils.isMarkerEvent(e)) {
189 this._markerEvents.push(e);
190 this._timelineData.markerTimestamps.push(e.startTime);
191 }
173 if (!this._isVisible(e)) 192 if (!this._isVisible(e))
174 continue; 193 continue;
175 while (openEvents.length && openEvents.peekLast().endTime <= e.start Time) { 194 while (openEvents.length && openEvents.peekLast().endTime <= e.start Time) {
176 openEvents.pop(); 195 openEvents.pop();
177 level = levels.pop(); 196 level = levels.pop();
178 jsStackHeight = jsHeights.pop(); 197 jsStackHeight = jsHeights.pop();
179 } 198 }
180 if (!headerAppended) { 199 if (!headerAppended) {
181 this._appendHeaderRecord(headerName, this._currentLevel); 200 this._appendHeaderRecord(headerName, this._currentLevel);
182 ++level; 201 ++level;
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 /** 644 /**
626 * @constructor 645 * @constructor
627 * @param {!WebInspector.TimelineSelection} selection 646 * @param {!WebInspector.TimelineSelection} selection
628 * @param {number} entryIndex 647 * @param {number} entryIndex
629 */ 648 */
630 WebInspector.TimelineFlameChart.Selection = function(selection, entryIndex) 649 WebInspector.TimelineFlameChart.Selection = function(selection, entryIndex)
631 { 650 {
632 this.timelineSelection = selection; 651 this.timelineSelection = selection;
633 this.entryIndex = entryIndex; 652 this.entryIndex = entryIndex;
634 } 653 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698