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

Side by Side Diff: tools/perf/metrics/smoothness.js

Issue 23998002: cc: Fixed computation of dropped frames. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 3 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
« no previous file with comments | « cc/debug/frame_rate_counter.cc ('k') | tools/perf/metrics/smoothness.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 'use strict'; 5 'use strict';
6 6
7 /** 7 /**
8 * @fileoverview This file provides the RenderingStats object, used 8 * @fileoverview This file provides the RenderingStats object, used
9 * to characterize rendering smoothness. 9 * to characterize rendering smoothness.
10 */ 10 */
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 RafRenderingStats.prototype.recordFrameTime_ = function(timestamp) { 142 RafRenderingStats.prototype.recordFrameTime_ = function(timestamp) {
143 if (!this.recording_) 143 if (!this.recording_)
144 return; 144 return;
145 145
146 this.frameTimes_.push(timestamp); 146 this.frameTimes_.push(timestamp);
147 requestAnimationFrame(this.recordFrameTime_.bind(this)); 147 requestAnimationFrame(this.recordFrameTime_.bind(this));
148 }; 148 };
149 149
150 RafRenderingStats.prototype.getDroppedFrameCount_ = function(frameTimes) { 150 RafRenderingStats.prototype.getDroppedFrameCount_ = function(frameTimes) {
151 var droppedFrameCount = 0; 151 var droppedFrameCount = 0;
152 var droppedFrameThreshold = 1000 / 55;
152 for (var i = 1; i < frameTimes.length; i++) { 153 for (var i = 1; i < frameTimes.length; i++) {
153 var frameTime = frameTimes[i] - frameTimes[i-1]; 154 var frameTime = frameTimes[i] - frameTimes[i-1];
154 if (frameTime > 1000 / 55) 155 if (frameTime > droppedFrameThreshold)
155 droppedFrameCount++; 156 droppedFrameCount += Math.floor(frameTime / droppedFrameThreshold);
156 } 157 }
157 return droppedFrameCount; 158 return droppedFrameCount;
158 }; 159 };
159 160
160 function RenderingStats() { 161 function RenderingStats() {
161 if (window.chrome && chrome.gpuBenchmarking && 162 if (window.chrome && chrome.gpuBenchmarking &&
162 chrome.gpuBenchmarking.renderingStats) { 163 chrome.gpuBenchmarking.renderingStats) {
163 return new GpuBenchmarkingRenderingStats(); 164 return new GpuBenchmarkingRenderingStats();
164 } 165 }
165 return new RafRenderingStats(); 166 return new RafRenderingStats();
166 } 167 }
167 168
168 window.__RenderingStats = RenderingStats; 169 window.__RenderingStats = RenderingStats;
169 })(); 170 })();
OLDNEW
« no previous file with comments | « cc/debug/frame_rate_counter.cc ('k') | tools/perf/metrics/smoothness.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698