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

Unified Diff: Source/devtools/front_end/timeline/TimelineEventOverview.js

Issue 1311013004: DevTools: Smooth CPU utilization overview chart on timeline (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/timeline/TimelineEventOverview.js
diff --git a/Source/devtools/front_end/timeline/TimelineEventOverview.js b/Source/devtools/front_end/timeline/TimelineEventOverview.js
index d732303b7348fb0f28650c1675eefcafa63a5f84..fce4ea5867ce5cf04e06f75fbc0ac1de5a8dd402 100644
--- a/Source/devtools/front_end/timeline/TimelineEventOverview.js
+++ b/Source/devtools/front_end/timeline/TimelineEventOverview.js
@@ -312,11 +312,12 @@ WebInspector.TimelineEventOverview.CPUActivity.prototype = {
{
WebInspector.TimelineEventOverview.prototype.update.call(this);
var /** @const */ quantSizePx = 4 * window.devicePixelRatio;
+ var width = this._canvas.width;
var height = this._canvas.height;
var baseLine = height;
var timeOffset = this._model.minimumRecordTime();
var timeSpan = this._model.maximumRecordTime() - timeOffset;
- var scale = this._canvas.width / timeSpan;
+ var scale = width / timeSpan;
var quantTime = quantSizePx / scale;
var categories = WebInspector.TimelineUIUtils.categories();
var categoryOrder = ["idle", "loading", "painting", "rendering", "scripting", "other"];
@@ -337,24 +338,28 @@ WebInspector.TimelineEventOverview.CPUActivity.prototype = {
*/
function drawThreadEvents(ctx, events)
{
- var quantizer = new WebInspector.Quantizer(timeOffset, quantTime, drawSample.bind(this));
+ var quantizer = new WebInspector.Quantizer(timeOffset, quantTime, drawSample);
var x = 0;
var categoryIndexStack = [];
+ var paths = [];
+ var lastY = [];
+ for (var i = 0; i < categoryOrder.length; ++i) {
+ paths[i] = new Path2D();
+ paths[i].moveTo(-1, height + 1);
caseq 2015/08/25 21:35:56 0, height?
alph 2015/08/25 21:36:48 Done.
+ lastY[i] = height;
+ }
/**
* @param {!Array<number>} counters
- * @this {WebInspector.TimelineEventOverview}
*/
function drawSample(counters)
{
var y = baseLine;
- for (var i = idleIndex + 1; i < counters.length; ++i) {
- if (!counters[i])
- continue;
- var h = counters[i] / quantTime * height;
- ctx.fillStyle = this._categoryColor(categories[categoryOrder[i]]);
- ctx.fillRect(x, y - h, quantSizePx, h);
+ for (var i = idleIndex + 1; i < categoryOrder.length; ++i) {
+ var h = (counters[i] || 0) / quantTime * height;
y -= h;
+ paths[i].bezierCurveTo(x, lastY[i], x, y, x + quantSizePx / 2, y);
+ lastY[i] = y;
}
x += quantSizePx;
}
@@ -379,6 +384,11 @@ WebInspector.TimelineEventOverview.CPUActivity.prototype = {
WebInspector.TimelineModel.forEachEvent(events, onEventStart, onEventEnd);
quantizer.appendInterval(timeOffset + timeSpan + quantTime, idleIndex); // Kick drawing the last bucket.
+ for (var i = categoryOrder.length - 1; i > 0; --i) {
+ paths[i].lineTo(width + 1, height + 1);
+ ctx.fillStyle = this._categoryColor(categories[categoryOrder[i]]);
+ ctx.fill(paths[i]);
+ }
}
},
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698