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

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

Issue 3001843002: Add TBMv2 metrics for WebVR. (Closed)
Patch Set: 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..bcc9e317ea09691149a0a40a5c030433a2f423da
--- /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.
+ const WEBVR_COUNTERS = {
+ 'gpu.WebVR FPS':
+ { 'name': 'webvr_fps',
benjhayden 2017/08/23 17:28:06 Please move the open brace to the previous line.
Lei Lei 2017/08/25 23:21:01 Done.
+ 'unit': tr.b.Unit.byName.count_biggerIsBetter,
+ 'options': {'description': 'WebVR frame per second'}
+ },
+ '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 = {};
benjhayden 2017/08/23 17:28:06 Please use an ES6 Map instead.
Lei Lei 2017/08/25 23:21:02 Done.
+ for (const s of counter.series) {
benjhayden 2017/08/23 17:28:06 Please rename 's' to 'series' for clarity.
Lei Lei 2017/08/25 23:21:01 Done.
+ nameToSamples[s.name] = nameToSamples[s.name] || [];
+ for (const sample of s.samples) {
+ nameToSamples[s.name].push(sample.value);
+ }
+ }
+
+ for (const [serieName, samples] of Object.entries(nameToSamples)) {
benjhayden 2017/08/23 17:28:06 'serie' is not a word. 'Series' is both singular a
Lei Lei 2017/08/25 23:21:01 Done.
+ let name = WEBVR_COUNTERS[counter.id].name;
+ if (serieName !== 'value') {
+ name = name + '_' + serieName;
+ }
+ 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