Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <!-- | |
| 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 | |
| 5 found in the LICENSE file. | |
| 6 --> | |
| 7 | |
| 8 <link rel="import" href="/tracing/metrics/metric_registry.html"> | |
| 9 <link rel="import" href="/tracing/value/histogram.html"> | |
| 10 | |
| 11 <script> | |
| 12 'use strict'; | |
| 13 | |
| 14 tr.exportTo('tr.metrics.vr', function() { | |
| 15 function webvrMetric(histograms, model) { | |
| 16 // 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.
| |
| 17 const WEBVR_COUNTERS = { | |
| 18 'gpu.WebVR FPS': { | |
| 19 '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
| |
| 20 'unit': tr.b.Unit.byName.count_biggerIsBetter, | |
| 21 '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.
| |
| 22 }, | |
| 23 'gpu.WebVR frame time (ms)': { | |
| 24 'name': 'webvr_frame_time', | |
| 25 'unit': tr.b.Unit.byName.timeDurationInMs_smallerIsBetter, | |
| 26 'options': {'description': 'WebVR frame time in ms'} | |
| 27 }, | |
| 28 'gpu.WebVR pose prediction (ms)': { | |
| 29 'name': 'webvr_pose_prediction', | |
| 30 'unit': tr.b.Unit.byName.timeDurationInMs_smallerIsBetter, | |
| 31 'options': {'description': 'WebVR pose prediction in ms'} | |
| 32 } | |
| 33 }; | |
| 34 | |
| 35 for (const counter of model.getAllCounters()) { | |
| 36 if (!(counter.id in WEBVR_COUNTERS)) continue; | |
| 37 | |
| 38 const nameToSamples = new Map(); | |
| 39 for (const series of counter.series) { | |
| 40 nameToSamples[series.name] = nameToSamples[series.name] || []; | |
| 41 for (const sample of series.samples) { | |
| 42 nameToSamples[series.name].push(sample.value); | |
| 43 } | |
| 44 } | |
| 45 | |
| 46 for (const [seriesName, samples] of Object.entries(nameToSamples)) { | |
| 47 let name = WEBVR_COUNTERS[counter.id].name; | |
| 48 if (seriesName !== 'value') { | |
| 49 name = name + '_' + seriesName; | |
| 50 } | |
| 51 histograms.createHistogram( | |
| 52 name, WEBVR_COUNTERS[counter.id].unit, samples, | |
| 53 WEBVR_COUNTERS[counter.id].options | |
| 54 ); | |
| 55 } | |
| 56 } | |
| 57 } | |
| 58 | |
| 59 tr.metrics.MetricRegistry.register(webvrMetric); | |
| 60 | |
| 61 return { | |
| 62 webvrMetric, | |
| 63 }; | |
| 64 }); | |
| 65 </script> | |
| OLD | NEW |