OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 */ | 195 */ |
196 _startBackgroundFrame: function(record) | 196 _startBackgroundFrame: function(record) |
197 { | 197 { |
198 if (!this._hasThreadedCompositing) { | 198 if (!this._hasThreadedCompositing) { |
199 this._lastFrame = null; | 199 this._lastFrame = null; |
200 this._hasThreadedCompositing = true; | 200 this._hasThreadedCompositing = true; |
201 } | 201 } |
202 if (this._lastFrame) | 202 if (this._lastFrame) |
203 this._flushFrame(this._lastFrame, record); | 203 this._flushFrame(this._lastFrame, record); |
204 | 204 |
205 this._lastFrame = new WebInspector.TimelineFrame(this, record); | 205 this._lastFrame = new WebInspector.TimelineFrame(record); |
206 }, | 206 }, |
207 | 207 |
208 /** | 208 /** |
209 * @param {!WebInspector.TimelineModel.Record} record | 209 * @param {!WebInspector.TimelineModel.Record} record |
210 */ | 210 */ |
211 _startMainThreadFrame: function(record) | 211 _startMainThreadFrame: function(record) |
212 { | 212 { |
213 if (this._lastFrame) | 213 if (this._lastFrame) |
214 this._flushFrame(this._lastFrame, record); | 214 this._flushFrame(this._lastFrame, record); |
215 this._lastFrame = new WebInspector.TimelineFrame(this, record); | 215 this._lastFrame = new WebInspector.TimelineFrame(record); |
216 }, | 216 }, |
217 | 217 |
218 /** | 218 /** |
219 * @param {!WebInspector.TimelineFrame} frame | 219 * @param {!WebInspector.TimelineFrame} frame |
220 * @param {!Object} record | 220 * @param {!Object} record |
221 */ | 221 */ |
222 _flushFrame: function(frame, record) | 222 _flushFrame: function(frame, record) |
223 { | 223 { |
224 frame._setEndTime(record.startTime); | 224 frame._setEndTime(record.startTime); |
225 this._frames.push(frame); | 225 this._frames.push(frame); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 this.maxDuration = Math.max(this.maxDuration, duration); | 272 this.maxDuration = Math.max(this.maxDuration, duration); |
273 WebInspector.TimelineUIUtils.aggregateTimeByCategory(this.timeByCategory
, frames[i].timeByCategory); | 273 WebInspector.TimelineUIUtils.aggregateTimeByCategory(this.timeByCategory
, frames[i].timeByCategory); |
274 } | 274 } |
275 this.average = totalDuration / this.frameCount; | 275 this.average = totalDuration / this.frameCount; |
276 var variance = sumOfSquares / this.frameCount - this.average * this.average; | 276 var variance = sumOfSquares / this.frameCount - this.average * this.average; |
277 this.stddev = Math.sqrt(variance); | 277 this.stddev = Math.sqrt(variance); |
278 } | 278 } |
279 | 279 |
280 /** | 280 /** |
281 * @constructor | 281 * @constructor |
282 * @param {!WebInspector.TimelineFrameModel} model | |
283 * @param {!Object} record | 282 * @param {!Object} record |
284 */ | 283 */ |
285 WebInspector.TimelineFrame = function(model, record) | 284 WebInspector.TimelineFrame = function(record) |
286 { | 285 { |
287 this.startTime = record.startTime; | 286 this.startTime = record.startTime; |
288 this.startTimeOffset = model._model.recordOffsetInMillis(record); | 287 this.startTimeOffset = record.startTimeOffset; |
289 this.endTime = this.startTime; | 288 this.endTime = this.startTime; |
290 this.duration = 0; | 289 this.duration = 0; |
291 this.timeByCategory = {}; | 290 this.timeByCategory = {}; |
292 this.cpuTime = 0; | 291 this.cpuTime = 0; |
293 } | 292 } |
294 | 293 |
295 WebInspector.TimelineFrame.prototype = { | 294 WebInspector.TimelineFrame.prototype = { |
296 /** | 295 /** |
297 * @param {number} endTime | 296 * @param {number} endTime |
298 */ | 297 */ |
(...skipping 23 matching lines...) Expand all Loading... |
322 this._updateCpuTime(); | 321 this._updateCpuTime(); |
323 }, | 322 }, |
324 | 323 |
325 _updateCpuTime: function() | 324 _updateCpuTime: function() |
326 { | 325 { |
327 this.cpuTime = 0; | 326 this.cpuTime = 0; |
328 for (var key in this.timeByCategory) | 327 for (var key in this.timeByCategory) |
329 this.cpuTime += this.timeByCategory[key]; | 328 this.cpuTime += this.timeByCategory[key]; |
330 } | 329 } |
331 } | 330 } |
OLD | NEW |