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

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

Issue 84483002: [telemetry] Fix types and type checks of numeric results. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 // 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 // This file contains common utilities to find video/audio elements on a page 5 // This file contains common utilities to find video/audio elements on a page
6 // and collect metrics for each. 6 // and collect metrics for each.
7 7
8 (function() { 8 (function() {
9 // MediaMetric class responsible for collecting metrics on a media element. 9 // MediaMetric class responsible for collecting metrics on a media element.
10 // It attaches required event listeners in order to collect different metrics. 10 // It attaches required event listeners in order to collect different metrics.
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 this.start(); 148 this.start();
149 } 149 }
150 150
151 Timer.prototype = { 151 Timer.prototype = {
152 start: function() { 152 start: function() {
153 this.start_ = getCurrentTime(); 153 this.start_ = getCurrentTime();
154 }, 154 },
155 155
156 stop: function() { 156 stop: function() {
157 // Return delta time since start in millisecs. 157 // Return delta time since start in millisecs.
158 return ((getCurrentTime() - this.start_)).toFixed(3); 158 return Math.round((getCurrentTime() - this.start_) * 1000) / 1000;
159 } 159 }
160 }; 160 };
161 161
162 function checkElementIsNotBound(element) { 162 function checkElementIsNotBound(element) {
163 if (!element) 163 if (!element)
164 return; 164 return;
165 if (getMediaMetric(element)) 165 if (getMediaMetric(element))
166 throw new Error('Can not create MediaMetric for same element twice.'); 166 throw new Error('Can not create MediaMetric for same element twice.');
167 } 167 }
168 168
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 metrics.push(window.__mediaMetrics[i].getSummary()); 200 metrics.push(window.__mediaMetrics[i].getSummary());
201 return metrics; 201 return metrics;
202 } 202 }
203 203
204 window.__globalCounter = 0; 204 window.__globalCounter = 0;
205 window.__mediaMetrics = []; 205 window.__mediaMetrics = [];
206 window.__getMediaMetric = getMediaMetric; 206 window.__getMediaMetric = getMediaMetric;
207 window.__getAllMetrics = getAllMetrics; 207 window.__getAllMetrics = getAllMetrics;
208 window.__createMediaMetricsForDocument = createMediaMetricsForDocument; 208 window.__createMediaMetricsForDocument = createMediaMetricsForDocument;
209 })(); 209 })();
OLDNEW
« no previous file with comments | « tools/perf/benchmarks/dromaeo.py ('k') | tools/telemetry/telemetry/value/list_of_scalar_values.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698