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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
49 /** | 49 /** |
50 * @param {number} begin | 50 * @param {number} begin |
51 * @param {number} end | 51 * @param {number} end |
52 * @param {number} position | 52 * @param {number} position |
53 * @param {number} height | 53 * @param {number} height |
54 * @param {string} color | 54 * @param {string} color |
55 */ | 55 */ |
56 _renderBar(begin, end, position, height, color) { | 56 _renderBar(begin, end, position, height, color) { |
57 var x = begin; | 57 var x = begin; |
58 var width = end - begin; | 58 var width = end - begin; |
59 this._context.fillStyle = color; | 59 var ctx = this.context(); |
60 this._context.fillRect(x, position, width, height); | 60 ctx.fillStyle = color; |
61 ctx.fillRect(x, position, width, height); | |
61 } | 62 } |
62 | 63 |
63 /** | 64 /** |
64 * @override | 65 * @override |
65 * @param {number} windowLeft | 66 * @param {number} windowLeft |
66 * @param {number} windowRight | 67 * @param {number} windowRight |
67 * @return {!{startTime: number, endTime: number}} | 68 * @return {!{startTime: number, endTime: number}} |
68 */ | 69 */ |
69 windowTimes(windowLeft, windowRight) { | 70 windowTimes(windowLeft, windowRight) { |
70 var absoluteMin = this._model.minimumRecordTime(); | 71 var absoluteMin = this._model.minimumRecordTime(); |
(...skipping 28 matching lines...) Expand all Loading... | |
99 constructor(model) { | 100 constructor(model) { |
100 super('input', null, model); | 101 super('input', null, model); |
101 } | 102 } |
102 | 103 |
103 /** | 104 /** |
104 * @override | 105 * @override |
105 */ | 106 */ |
106 update() { | 107 update() { |
107 super.update(); | 108 super.update(); |
108 var events = this._model.mainThreadEvents(); | 109 var events = this._model.mainThreadEvents(); |
109 var height = this._canvas.height; | 110 var height = this.height(); |
110 var descriptors = Timeline.TimelineUIUtils.eventDispatchDesciptors(); | 111 var descriptors = Timeline.TimelineUIUtils.eventDispatchDesciptors(); |
111 /** @type {!Map.<string,!Timeline.TimelineUIUtils.EventDispatchTypeDescripto r>} */ | 112 /** @type {!Map.<string,!Timeline.TimelineUIUtils.EventDispatchTypeDescripto r>} */ |
112 var descriptorsByType = new Map(); | 113 var descriptorsByType = new Map(); |
113 var maxPriority = -1; | 114 var maxPriority = -1; |
114 for (var descriptor of descriptors) { | 115 for (var descriptor of descriptors) { |
115 for (var type of descriptor.eventTypes) | 116 for (var type of descriptor.eventTypes) |
116 descriptorsByType.set(type, descriptor); | 117 descriptorsByType.set(type, descriptor); |
117 maxPriority = Math.max(maxPriority, descriptor.priority); | 118 maxPriority = Math.max(maxPriority, descriptor.priority); |
118 } | 119 } |
119 | 120 |
120 var /** @const */ minWidth = 2 * window.devicePixelRatio; | 121 var /** @const */ minWidth = 2 * window.devicePixelRatio; |
121 var timeOffset = this._model.minimumRecordTime(); | 122 var timeOffset = this._model.minimumRecordTime(); |
122 var timeSpan = this._model.maximumRecordTime() - timeOffset; | 123 var timeSpan = this._model.maximumRecordTime() - timeOffset; |
123 var canvasWidth = this._canvas.width; | 124 var canvasWidth = this.width(); |
124 var scale = canvasWidth / timeSpan; | 125 var scale = canvasWidth / timeSpan; |
125 | 126 |
126 for (var priority = 0; priority <= maxPriority; ++priority) { | 127 for (var priority = 0; priority <= maxPriority; ++priority) { |
127 for (var i = 0; i < events.length; ++i) { | 128 for (var i = 0; i < events.length; ++i) { |
128 var event = events[i]; | 129 var event = events[i]; |
129 if (event.name !== TimelineModel.TimelineModel.RecordType.EventDispatch) | 130 if (event.name !== TimelineModel.TimelineModel.RecordType.EventDispatch) |
130 continue; | 131 continue; |
131 var descriptor = descriptorsByType.get(event.args['data']['type']); | 132 var descriptor = descriptorsByType.get(event.args['data']['type']); |
132 if (!descriptor || descriptor.priority !== priority) | 133 if (!descriptor || descriptor.priority !== priority) |
133 continue; | 134 continue; |
(...skipping 15 matching lines...) Expand all Loading... | |
149 */ | 150 */ |
150 constructor(model) { | 151 constructor(model) { |
151 super('network', Common.UIString('NET'), model); | 152 super('network', Common.UIString('NET'), model); |
152 } | 153 } |
153 | 154 |
154 /** | 155 /** |
155 * @override | 156 * @override |
156 */ | 157 */ |
157 update() { | 158 update() { |
158 super.update(); | 159 super.update(); |
159 var height = this._canvas.height; | 160 var height = this.height(); |
160 var numBands = categoryBand(Timeline.TimelineUIUtils.NetworkCategory.Other) + 1; | 161 var numBands = categoryBand(Timeline.TimelineUIUtils.NetworkCategory.Other) + 1; |
161 var bandHeight = Math.floor(height / numBands); | 162 var bandHeight = Math.floor(height / numBands); |
162 var devicePixelRatio = window.devicePixelRatio; | 163 var devicePixelRatio = window.devicePixelRatio; |
163 var timeOffset = this._model.minimumRecordTime(); | 164 var timeOffset = this._model.minimumRecordTime(); |
164 var timeSpan = this._model.maximumRecordTime() - timeOffset; | 165 var timeSpan = this._model.maximumRecordTime() - timeOffset; |
165 var canvasWidth = this._canvas.width; | 166 var canvasWidth = this.width(); |
166 var scale = canvasWidth / timeSpan; | 167 var scale = canvasWidth / timeSpan; |
167 var ctx = this._context; | 168 var ctx = this.context(); |
168 var requests = this._model.networkRequests(); | 169 var requests = this._model.networkRequests(); |
169 /** @type {!Map<string,!{waiting:!Path2D,transfer:!Path2D}>} */ | 170 /** @type {!Map<string,!{waiting:!Path2D,transfer:!Path2D}>} */ |
170 var paths = new Map(); | 171 var paths = new Map(); |
171 requests.forEach(drawRequest); | 172 requests.forEach(drawRequest); |
172 for (var path of paths) { | 173 for (var path of paths) { |
173 ctx.fillStyle = path[0]; | 174 ctx.fillStyle = path[0]; |
174 ctx.globalAlpha = 0.3; | 175 ctx.globalAlpha = 0.3; |
175 ctx.fill(path[1]['waiting']); | 176 ctx.fill(path[1]['waiting']); |
176 ctx.globalAlpha = 1; | 177 ctx.globalAlpha = 1; |
177 ctx.fill(path[1]['transfer']); | 178 ctx.fill(path[1]['transfer']); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
243 this._backgroundCanvas.width = this.element.clientWidth * window.devicePixel Ratio; | 244 this._backgroundCanvas.width = this.element.clientWidth * window.devicePixel Ratio; |
244 this._backgroundCanvas.height = this.element.clientHeight * window.devicePix elRatio; | 245 this._backgroundCanvas.height = this.element.clientHeight * window.devicePix elRatio; |
245 } | 246 } |
246 | 247 |
247 /** | 248 /** |
248 * @override | 249 * @override |
249 */ | 250 */ |
250 update() { | 251 update() { |
251 super.update(); | 252 super.update(); |
252 var /** @const */ quantSizePx = 4 * window.devicePixelRatio; | 253 var /** @const */ quantSizePx = 4 * window.devicePixelRatio; |
253 var width = this._canvas.width; | 254 var width = this.width(); |
254 var height = this._canvas.height; | 255 var height = this.height(); |
255 var baseLine = height; | 256 var baseLine = height; |
256 var timeOffset = this._model.minimumRecordTime(); | 257 var timeOffset = this._model.minimumRecordTime(); |
257 var timeSpan = this._model.maximumRecordTime() - timeOffset; | 258 var timeSpan = this._model.maximumRecordTime() - timeOffset; |
258 var scale = width / timeSpan; | 259 var scale = width / timeSpan; |
259 var quantTime = quantSizePx / scale; | 260 var quantTime = quantSizePx / scale; |
260 var categories = Timeline.TimelineUIUtils.categories(); | 261 var categories = Timeline.TimelineUIUtils.categories(); |
261 var categoryOrder = ['idle', 'loading', 'painting', 'rendering', 'scripting' , 'other']; | 262 var categoryOrder = ['idle', 'loading', 'painting', 'rendering', 'scripting' , 'other']; |
262 var otherIndex = categoryOrder.indexOf('other'); | 263 var otherIndex = categoryOrder.indexOf('other'); |
263 var idleIndex = 0; | 264 var idleIndex = 0; |
264 console.assert(idleIndex === categoryOrder.indexOf('idle')); | 265 console.assert(idleIndex === categoryOrder.indexOf('idle')); |
265 for (var i = idleIndex + 1; i < categoryOrder.length; ++i) | 266 for (var i = idleIndex + 1; i < categoryOrder.length; ++i) |
266 categories[categoryOrder[i]]._overviewIndex = i; | 267 categories[categoryOrder[i]]._overviewIndex = i; |
267 | 268 |
268 var backgroundContext = this._backgroundCanvas.getContext('2d'); | 269 var backgroundContext = this._backgroundCanvas.getContext('2d'); |
269 for (var thread of this._model.virtualThreads()) | 270 for (var thread of this._model.virtualThreads()) |
270 drawThreadEvents(backgroundContext, thread.events); | 271 drawThreadEvents(backgroundContext, thread.events); |
271 applyPattern(backgroundContext); | 272 applyPattern(backgroundContext); |
272 drawThreadEvents(this._context, this._model.mainThreadEvents()); | 273 drawThreadEvents(this.context(), this._model.mainThreadEvents()); |
273 | 274 |
274 /** | 275 /** |
275 * @param {!CanvasRenderingContext2D} ctx | 276 * @param {!CanvasRenderingContext2D} ctx |
276 * @param {!Array<!SDK.TracingModel.Event>} events | 277 * @param {!Array<!SDK.TracingModel.Event>} events |
277 */ | 278 */ |
278 function drawThreadEvents(ctx, events) { | 279 function drawThreadEvents(ctx, events) { |
279 var quantizer = new Timeline.Quantizer(timeOffset, quantTime, drawSample); | 280 var quantizer = new Timeline.Quantizer(timeOffset, quantTime, drawSample); |
280 var x = 0; | 281 var x = 0; |
281 var categoryIndexStack = []; | 282 var categoryIndexStack = []; |
282 var paths = []; | 283 var paths = []; |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
355 constructor(model, frameModel) { | 356 constructor(model, frameModel) { |
356 super('responsiveness', null, model); | 357 super('responsiveness', null, model); |
357 this._frameModel = frameModel; | 358 this._frameModel = frameModel; |
358 } | 359 } |
359 | 360 |
360 /** | 361 /** |
361 * @override | 362 * @override |
362 */ | 363 */ |
363 update() { | 364 update() { |
364 super.update(); | 365 super.update(); |
365 var height = this._canvas.height; | 366 var height = this.height(); |
366 var timeOffset = this._model.minimumRecordTime(); | 367 var timeOffset = this._model.minimumRecordTime(); |
367 var timeSpan = this._model.maximumRecordTime() - timeOffset; | 368 var timeSpan = this._model.maximumRecordTime() - timeOffset; |
368 var scale = this._canvas.width / timeSpan; | 369 var scale = this.width() / timeSpan; |
369 var frames = this._frameModel.frames(); | 370 var frames = this._frameModel.frames(); |
370 var ctx = this._context; | 371 // This is due to usage of new signatures of fill() and storke() that closur e compiler does not recognize. |
alph
2016/12/09 05:53:37
Can't you just add them to externs.js ?
| |
372 var ctx = /** @type {!Object} */ (this.context()); | |
371 var fillPath = new Path2D(); | 373 var fillPath = new Path2D(); |
372 var markersPath = new Path2D(); | 374 var markersPath = new Path2D(); |
373 for (var i = 0; i < frames.length; ++i) { | 375 for (var i = 0; i < frames.length; ++i) { |
374 var frame = frames[i]; | 376 var frame = frames[i]; |
375 if (!frame.hasWarnings()) | 377 if (!frame.hasWarnings()) |
376 continue; | 378 continue; |
377 paintWarningDecoration(frame.startTime, frame.duration); | 379 paintWarningDecoration(frame.startTime, frame.duration); |
378 } | 380 } |
379 | 381 |
380 var events = this._model.mainThreadEvents(); | 382 var events = this._model.mainThreadEvents(); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
427 if (!frames.length) | 429 if (!frames.length) |
428 return; | 430 return; |
429 | 431 |
430 var drawGeneration = Symbol('drawGeneration'); | 432 var drawGeneration = Symbol('drawGeneration'); |
431 this._drawGeneration = drawGeneration; | 433 this._drawGeneration = drawGeneration; |
432 this._imageByFrame(frames[0]).then(image => { | 434 this._imageByFrame(frames[0]).then(image => { |
433 if (this._drawGeneration !== drawGeneration) | 435 if (this._drawGeneration !== drawGeneration) |
434 return; | 436 return; |
435 if (!image.naturalWidth || !image.naturalHeight) | 437 if (!image.naturalWidth || !image.naturalHeight) |
436 return; | 438 return; |
437 var imageHeight = this._canvas.height - 2 * Timeline.TimelineFilmStripOver view.Padding; | 439 var imageHeight = this.height() - 2 * Timeline.TimelineFilmStripOverview.P adding; |
438 var imageWidth = Math.ceil(imageHeight * image.naturalWidth / image.natura lHeight); | 440 var imageWidth = Math.ceil(imageHeight * image.naturalWidth / image.natura lHeight); |
439 var popoverScale = Math.min(200 / image.naturalWidth, 1); | 441 var popoverScale = Math.min(200 / image.naturalWidth, 1); |
440 this._emptyImage = new Image(image.naturalWidth * popoverScale, image.natu ralHeight * popoverScale); | 442 this._emptyImage = new Image(image.naturalWidth * popoverScale, image.natu ralHeight * popoverScale); |
441 this._drawFrames(imageWidth, imageHeight); | 443 this._drawFrames(imageWidth, imageHeight); |
442 }); | 444 }); |
443 } | 445 } |
444 | 446 |
445 /** | 447 /** |
446 * @param {!Components.FilmStripModel.Frame} frame | 448 * @param {!Components.FilmStripModel.Frame} frame |
447 * @return {!Promise<!HTMLImageElement>} | 449 * @return {!Promise<!HTMLImageElement>} |
(...skipping 30 matching lines...) Expand all Loading... | |
478 /** | 480 /** |
479 * @param {number} imageWidth | 481 * @param {number} imageWidth |
480 * @param {number} imageHeight | 482 * @param {number} imageHeight |
481 */ | 483 */ |
482 _drawFrames(imageWidth, imageHeight) { | 484 _drawFrames(imageWidth, imageHeight) { |
483 if (!imageWidth) | 485 if (!imageWidth) |
484 return; | 486 return; |
485 if (!this._filmStripModel.frames().length) | 487 if (!this._filmStripModel.frames().length) |
486 return; | 488 return; |
487 var padding = Timeline.TimelineFilmStripOverview.Padding; | 489 var padding = Timeline.TimelineFilmStripOverview.Padding; |
488 var width = this._canvas.width; | 490 var width = this.width(); |
489 var zeroTime = this._filmStripModel.zeroTime(); | 491 var zeroTime = this._filmStripModel.zeroTime(); |
490 var spanTime = this._filmStripModel.spanTime(); | 492 var spanTime = this._filmStripModel.spanTime(); |
491 var scale = spanTime / width; | 493 var scale = spanTime / width; |
492 var context = this._canvas.getContext('2d'); | 494 var context = this.context(); |
493 var drawGeneration = this._drawGeneration; | 495 var drawGeneration = this._drawGeneration; |
494 | 496 |
495 context.beginPath(); | 497 context.beginPath(); |
496 for (var x = padding; x < width; x += imageWidth + 2 * padding) { | 498 for (var x = padding; x < width; x += imageWidth + 2 * padding) { |
497 var time = zeroTime + (x + imageWidth / 2) * scale; | 499 var time = zeroTime + (x + imageWidth / 2) * scale; |
498 var frame = this._filmStripModel.frameByTimestamp(time); | 500 var frame = this._filmStripModel.frameByTimestamp(time); |
499 if (!frame) | 501 if (!frame) |
500 continue; | 502 continue; |
501 context.rect(x - 0.5, 0.5, imageWidth + 1, imageHeight + 1); | 503 context.rect(x - 0.5, 0.5, imageWidth + 1, imageHeight + 1); |
502 this._imageByFrame(frame).then(drawFrameImage.bind(this, x)); | 504 this._imageByFrame(frame).then(drawFrameImage.bind(this, x)); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
573 constructor(model, frameModel) { | 575 constructor(model, frameModel) { |
574 super('framerate', Common.UIString('FPS'), model); | 576 super('framerate', Common.UIString('FPS'), model); |
575 this._frameModel = frameModel; | 577 this._frameModel = frameModel; |
576 } | 578 } |
577 | 579 |
578 /** | 580 /** |
579 * @override | 581 * @override |
580 */ | 582 */ |
581 update() { | 583 update() { |
582 super.update(); | 584 super.update(); |
583 var height = this._canvas.height; | 585 var height = this.height(); |
584 var /** @const */ padding = 1 * window.devicePixelRatio; | 586 var /** @const */ padding = 1 * window.devicePixelRatio; |
585 var /** @const */ baseFrameDurationMs = 1e3 / 60; | 587 var /** @const */ baseFrameDurationMs = 1e3 / 60; |
586 var visualHeight = height - 2 * padding; | 588 var visualHeight = height - 2 * padding; |
587 var timeOffset = this._model.minimumRecordTime(); | 589 var timeOffset = this._model.minimumRecordTime(); |
588 var timeSpan = this._model.maximumRecordTime() - timeOffset; | 590 var timeSpan = this._model.maximumRecordTime() - timeOffset; |
589 var scale = this._canvas.width / timeSpan; | 591 var scale = this.width() / timeSpan; |
590 var frames = this._frameModel.frames(); | 592 var frames = this._frameModel.frames(); |
591 var baseY = height - padding; | 593 var baseY = height - padding; |
592 var ctx = this._context; | 594 var ctx = this.context(); |
593 var bottomY = baseY + 10 * window.devicePixelRatio; | 595 var bottomY = baseY + 10 * window.devicePixelRatio; |
596 var x = 0; | |
594 var y = bottomY; | 597 var y = bottomY; |
595 if (!frames.length) | 598 if (!frames.length) |
596 return; | 599 return; |
597 | 600 |
598 var lineWidth = window.devicePixelRatio; | 601 var lineWidth = window.devicePixelRatio; |
599 var offset = lineWidth & 1 ? 0.5 : 0; | 602 var offset = lineWidth & 1 ? 0.5 : 0; |
600 var tickDepth = 1.5 * window.devicePixelRatio; | 603 var tickDepth = 1.5 * window.devicePixelRatio; |
601 ctx.beginPath(); | 604 ctx.beginPath(); |
602 ctx.moveTo(0, y); | 605 ctx.moveTo(0, y); |
603 for (var i = 0; i < frames.length; ++i) { | 606 for (var i = 0; i < frames.length; ++i) { |
604 var frame = frames[i]; | 607 var frame = frames[i]; |
605 var x = Math.round((frame.startTime - timeOffset) * scale) + offset; | 608 x = Math.round((frame.startTime - timeOffset) * scale) + offset; |
606 ctx.lineTo(x, y); | 609 ctx.lineTo(x, y); |
607 ctx.lineTo(x, y + tickDepth); | 610 ctx.lineTo(x, y + tickDepth); |
608 y = frame.idle ? bottomY : | 611 y = frame.idle ? bottomY : |
609 Math.round(baseY - visualHeight * Math.min(baseFrameDurat ionMs / frame.duration, 1)) - offset; | 612 Math.round(baseY - visualHeight * Math.min(baseFrameDurat ionMs / frame.duration, 1)) - offset; |
610 ctx.lineTo(x, y + tickDepth); | 613 ctx.lineTo(x, y + tickDepth); |
611 ctx.lineTo(x, y); | 614 ctx.lineTo(x, y); |
612 } | 615 } |
613 if (frames.length) { | 616 if (frames.length) { |
614 var lastFrame = frames.peekLast(); | 617 var lastFrame = frames.peekLast(); |
615 var x = Math.round((lastFrame.startTime + lastFrame.duration - timeOffset) * scale) + offset; | 618 x = Math.round((lastFrame.startTime + lastFrame.duration - timeOffset) * s cale) + offset; |
616 ctx.lineTo(x, y); | 619 ctx.lineTo(x, y); |
617 } | 620 } |
618 ctx.lineTo(x, bottomY); | 621 ctx.lineTo(x, bottomY); |
619 ctx.fillStyle = 'hsl(110, 50%, 88%)'; | 622 ctx.fillStyle = 'hsl(110, 50%, 88%)'; |
620 ctx.strokeStyle = 'hsl(110, 50%, 60%)'; | 623 ctx.strokeStyle = 'hsl(110, 50%, 60%)'; |
621 ctx.lineWidth = lineWidth; | 624 ctx.lineWidth = lineWidth; |
622 ctx.fill(); | 625 ctx.fill(); |
623 ctx.stroke(); | 626 ctx.stroke(); |
624 } | 627 } |
625 }; | 628 }; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
673 var counters = event.args.data; | 676 var counters = event.args.data; |
674 if (!counters || !counters.jsHeapSizeUsed) | 677 if (!counters || !counters.jsHeapSizeUsed) |
675 return; | 678 return; |
676 maxUsedHeapSize = Math.max(maxUsedHeapSize, counters.jsHeapSizeUsed); | 679 maxUsedHeapSize = Math.max(maxUsedHeapSize, counters.jsHeapSizeUsed); |
677 minUsedHeapSize = Math.min(minUsedHeapSize, counters.jsHeapSizeUsed); | 680 minUsedHeapSize = Math.min(minUsedHeapSize, counters.jsHeapSizeUsed); |
678 } | 681 } |
679 events.forEach(calculateMinMaxSizes); | 682 events.forEach(calculateMinMaxSizes); |
680 minUsedHeapSize = Math.min(minUsedHeapSize, maxUsedHeapSize); | 683 minUsedHeapSize = Math.min(minUsedHeapSize, maxUsedHeapSize); |
681 | 684 |
682 var lineWidth = 1; | 685 var lineWidth = 1; |
683 var width = this._canvas.width; | 686 var width = this.width(); |
684 var height = this._canvas.height - lowerOffset; | 687 var height = this.height() - lowerOffset; |
685 var xFactor = width / (maxTime - minTime); | 688 var xFactor = width / (maxTime - minTime); |
686 var yFactor = (height - lineWidth) / Math.max(maxUsedHeapSize - minUsedHeapS ize, 1); | 689 var yFactor = (height - lineWidth) / Math.max(maxUsedHeapSize - minUsedHeapS ize, 1); |
687 | 690 |
688 var histogram = new Array(width); | 691 var histogram = new Array(width); |
689 | 692 |
690 /** | 693 /** |
691 * @param {!SDK.TracingModel.Event} event | 694 * @param {!SDK.TracingModel.Event} event |
692 */ | 695 */ |
693 function buildHistogram(event) { | 696 function buildHistogram(event) { |
694 var counters = event.args.data; | 697 var counters = event.args.data; |
695 if (!counters || !counters.jsHeapSizeUsed) | 698 if (!counters || !counters.jsHeapSizeUsed) |
696 return; | 699 return; |
697 var x = Math.round((event.startTime - minTime) * xFactor); | 700 var x = Math.round((event.startTime - minTime) * xFactor); |
698 var y = Math.round((counters.jsHeapSizeUsed - minUsedHeapSize) * yFactor); | 701 var y = Math.round((counters.jsHeapSizeUsed - minUsedHeapSize) * yFactor); |
699 histogram[x] = Math.max(histogram[x] || 0, y); | 702 histogram[x] = Math.max(histogram[x] || 0, y); |
700 } | 703 } |
701 events.forEach(buildHistogram); | 704 events.forEach(buildHistogram); |
702 | 705 |
703 var ctx = this._context; | 706 var ctx = this.context(); |
704 var heightBeyondView = height + lowerOffset + lineWidth; | 707 var heightBeyondView = height + lowerOffset + lineWidth; |
705 | 708 |
706 ctx.translate(0.5, 0.5); | 709 ctx.translate(0.5, 0.5); |
707 ctx.beginPath(); | 710 ctx.beginPath(); |
708 ctx.moveTo(-lineWidth, heightBeyondView); | 711 ctx.moveTo(-lineWidth, heightBeyondView); |
709 var y = 0; | 712 var y = 0; |
710 var isFirstPoint = true; | 713 var isFirstPoint = true; |
711 var lastX = 0; | 714 var lastX = 0; |
712 for (var x = 0; x < histogram.length; x++) { | 715 for (var x = 0; x < histogram.length; x++) { |
713 if (typeof histogram[x] === 'undefined') | 716 if (typeof histogram[x] === 'undefined') |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
776 counters[group] = this._quantDuration; | 779 counters[group] = this._quantDuration; |
777 this._callback(counters); | 780 this._callback(counters); |
778 interval -= this._quantDuration; | 781 interval -= this._quantDuration; |
779 } | 782 } |
780 this._counters = []; | 783 this._counters = []; |
781 this._counters[group] = interval; | 784 this._counters[group] = interval; |
782 this._lastTime = time; | 785 this._lastTime = time; |
783 this._remainder = this._quantDuration - interval; | 786 this._remainder = this._quantDuration - interval; |
784 } | 787 } |
785 }; | 788 }; |
OLD | NEW |