OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <!-- | 2 <!-- |
3 Copyright 2017 The Chromium Authors. All rights reserved. | 3 Copyright 2017 The Chromium Authors. All rights reserved. |
4 Use of this source code is governed by a BSD-style license that can be | 4 Use of this source code is governed by a BSD-style license that can be |
5 found in the LICENSE file. | 5 found in the LICENSE file. |
6 --> | 6 --> |
7 | 7 |
8 <link rel="import" href="/tracing/metrics/metric_registry.html"> | 8 <link rel="import" href="/tracing/metrics/metric_registry.html"> |
9 <link rel="import" href="/tracing/value/histogram.html"> | 9 <link rel="import" href="/tracing/value/histogram.html"> |
10 | 10 |
11 <script> | 11 <script> |
12 'use strict'; | 12 'use strict'; |
| 13 /* eslint-disable no-console */ |
13 | 14 |
14 tr.exportTo('tr.metrics.vr', function() { | 15 tr.exportTo('tr.metrics.vr', function() { |
15 function webvrMetric(histograms, model) { | 16 function webvrMetric(histograms, model) { |
16 // Maps VR trace counters to histogram. | 17 // Maps VR trace counters to histogram. |
17 const WEBVR_COUNTERS = new Map([ | 18 const WEBVR_COUNTERS = new Map([ |
18 ['gpu.WebVR FPS', new Map([ | 19 ['gpu.WebVR FPS', new Map([ |
19 ['name', 'webvr_fps'], | 20 ['name', 'webvr_fps'], |
20 ['unit', tr.b.Unit.byName.count_biggerIsBetter], | 21 ['unit', tr.b.Unit.byName.count_biggerIsBetter], |
21 ['options', new Map([ | 22 ['options', new Map([ |
22 ['description', 'WebVR frame per second'], | 23 ['description', 'WebVR frame per second'], |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 nameToSamples[series.name].push(sample.value); | 55 nameToSamples[series.name].push(sample.value); |
55 } | 56 } |
56 } | 57 } |
57 | 58 |
58 for (const [seriesName, samples] of Object.entries(nameToSamples)) { | 59 for (const [seriesName, samples] of Object.entries(nameToSamples)) { |
59 let name = WEBVR_COUNTERS.get(counter.id).get('name'); | 60 let name = WEBVR_COUNTERS.get(counter.id).get('name'); |
60 if (seriesName !== 'value') { | 61 if (seriesName !== 'value') { |
61 name = name + '_' + seriesName; | 62 name = name + '_' + seriesName; |
62 } | 63 } |
63 | 64 |
| 65 console.log(name + ':' + samples.toString()); |
| 66 |
64 histograms.createHistogram( | 67 histograms.createHistogram( |
65 name, WEBVR_COUNTERS.get(counter.id).get('unit'), samples, | 68 name, WEBVR_COUNTERS.get(counter.id).get('unit'), samples, |
66 WEBVR_COUNTERS.get(counter.id).get('options') | 69 WEBVR_COUNTERS.get(counter.id).get('options') |
67 ); | 70 ); |
68 } | 71 } |
69 } | 72 } |
70 } | 73 } |
71 | 74 |
72 tr.metrics.MetricRegistry.register(webvrMetric); | 75 tr.metrics.MetricRegistry.register(webvrMetric); |
73 | 76 |
74 return { | 77 return { |
75 webvrMetric, | 78 webvrMetric, |
76 }; | 79 }; |
77 }); | 80 }); |
78 </script> | 81 </script> |
OLD | NEW |