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

Unified Diff: tracing/tracing/metrics/vr/webvr_metric.html

Issue 3001843002: Add TBMv2 metrics for WebVR. (Closed)
Patch Set: Addressed Ben's comments Created 3 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 | « tracing/tracing/metrics/all_metrics.html ('k') | tracing/tracing/metrics/vr/webvr_metric_test.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tracing/tracing/metrics/vr/webvr_metric.html
diff --git a/tracing/tracing/metrics/vr/webvr_metric.html b/tracing/tracing/metrics/vr/webvr_metric.html
new file mode 100644
index 0000000000000000000000000000000000000000..7b8e191d194448a719ded3bfaf52bb76b90aa395
--- /dev/null
+++ b/tracing/tracing/metrics/vr/webvr_metric.html
@@ -0,0 +1,65 @@
+<!DOCTYPE html>
+<!--
+Copyright 2017 The Chromium Authors. All rights reserved.
+Use of this source code is governed by a BSD-style license that can be
+found in the LICENSE file.
+-->
+
+<link rel="import" href="/tracing/metrics/metric_registry.html">
+<link rel="import" href="/tracing/value/histogram.html">
+
+<script>
+'use strict';
+
+tr.exportTo('tr.metrics.vr', function() {
+ function webvrMetric(histograms, model) {
+ // Maps VR trace counters to histogram.
benjhayden 2017/08/28 05:25:54 Please change this to an ES6 Map.
Lei Lei 2017/08/29 00:13:39 Done.
+ const WEBVR_COUNTERS = {
+ 'gpu.WebVR FPS': {
+ 'name': 'webvr_fps',
benjhayden 2017/08/28 05:25:54 No need to put quotes around dictionary keys that
Lei Lei 2017/08/29 00:13:39 I tried to remove quotes around dictionary keys, h
benjhayden 2017/08/29 05:54:13 Sorry, my fault. Dictionary keys don't need to be
+ 'unit': tr.b.Unit.byName.count_biggerIsBetter,
+ 'options': {'description': 'WebVR frame per second'}
benjhayden 2017/08/28 05:25:54 The default bin boundaries for the count unit are
Lei Lei 2017/08/29 00:13:39 Done.
+ },
+ 'gpu.WebVR frame time (ms)': {
+ 'name': 'webvr_frame_time',
+ 'unit': tr.b.Unit.byName.timeDurationInMs_smallerIsBetter,
+ 'options': {'description': 'WebVR frame time in ms'}
+ },
+ 'gpu.WebVR pose prediction (ms)': {
+ 'name': 'webvr_pose_prediction',
+ 'unit': tr.b.Unit.byName.timeDurationInMs_smallerIsBetter,
+ 'options': {'description': 'WebVR pose prediction in ms'}
+ }
+ };
+
+ for (const counter of model.getAllCounters()) {
+ if (!(counter.id in WEBVR_COUNTERS)) continue;
+
+ const nameToSamples = new Map();
+ for (const series of counter.series) {
+ nameToSamples[series.name] = nameToSamples[series.name] || [];
+ for (const sample of series.samples) {
+ nameToSamples[series.name].push(sample.value);
+ }
+ }
+
+ for (const [seriesName, samples] of Object.entries(nameToSamples)) {
+ let name = WEBVR_COUNTERS[counter.id].name;
+ if (seriesName !== 'value') {
+ name = name + '_' + seriesName;
+ }
+ histograms.createHistogram(
+ name, WEBVR_COUNTERS[counter.id].unit, samples,
+ WEBVR_COUNTERS[counter.id].options
+ );
+ }
+ }
+ }
+
+ tr.metrics.MetricRegistry.register(webvrMetric);
+
+ return {
+ webvrMetric,
+ };
+});
+</script>
« no previous file with comments | « tracing/tracing/metrics/all_metrics.html ('k') | tracing/tracing/metrics/vr/webvr_metric_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698