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

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

Issue 3010693002: [vr] Add metric to measure frame cycle times (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
Index: tracing/tracing/metrics/vr/frame_cycle_duration_metric.html
diff --git a/tracing/tracing/metrics/vr/frame_cycle_duration_metric.html b/tracing/tracing/metrics/vr/frame_cycle_duration_metric.html
new file mode 100644
index 0000000000000000000000000000000000000000..3c9ef9b6463fc5b97af5e3a042cb384bdbd359bb
--- /dev/null
+++ b/tracing/tracing/metrics/vr/frame_cycle_duration_metric.html
@@ -0,0 +1,90 @@
+<!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 frameCycleDurationMetric(histograms, model) {
+ const FRAME_CYCLE_EVENTS = new Map([
benjhayden 2017/08/30 18:38:39 This would be more readable as code instead of dat
tiborg 2017/08/30 22:12:29 Oh, these a great suggestions! Makes it much clean
+ ['VrShellGl::DrawFrame', new Map([
+ ['name', 'draw_frame'],
+ ['unit', tr.b.Unit.byName.timeDurationInMs_smallerIsBetter],
+ ['options', new Map([
+ ['description', 'Duration to render one frame']
+ ])]
+ ])],
+ ['VrShellGl::AcquireFrame', new Map([
+ ['name', 'acquire_frame'],
+ ['unit', tr.b.Unit.byName.timeDurationInMs_smallerIsBetter],
+ ['options', new Map([
+ ['description', 'Duration acquire a frame from GVR']
+ ])]
+ ])],
+ ['VrShellGl::UpdateController', new Map([
+ ['name', 'update_controller'],
+ ['unit', tr.b.Unit.byName.timeDurationInMs_smallerIsBetter],
+ ['options', new Map([
+ ['description', 'Duration to query input from the controller']
+ ])]
+ ])],
+ ['VrShellGl::DrawWorldElements', new Map([
+ ['name', 'draw_world_elements'],
+ ['unit', tr.b.Unit.byName.timeDurationInMs_smallerIsBetter],
+ ['options', new Map([
+ ['description', 'Duration to draw world UI elements']
+ ])]
+ ])],
+ ['VrShellGl::DrawFrameSubmitWhenReady', new Map([
+ ['name', 'submit_frame'],
+ ['unit', tr.b.Unit.byName.timeDurationInMs_smallerIsBetter],
+ ['options', new Map([
+ ['description', 'Duration to submit a frame to GVR']
+ ])]
+ ])],
+ ['VrShellGl::DrawUiView', new Map([
+ ['name', 'draw_ui'],
+ ['unit', tr.b.Unit.byName.timeDurationInMs_smallerIsBetter],
+ ['options', new Map([
+ ['description', 'Duration to draw the UI']
+ ])]
+ ])]
+ ]);
+
+ const titleToSamples = new Map();
+ for (const event of model.getDescendantEvents()) {
benjhayden 2017/08/30 18:38:39 Metric performance doesn't matter terribly much wh
tiborg 2017/08/30 22:12:29 That sounds very good! Unfortunately, the tracing
+ if (!(FRAME_CYCLE_EVENTS.has(event.title))) {
+ continue;
+ }
+ titleToSamples[event.title] = titleToSamples[event.title] ||
+ {cpuDuration: [], wallDuration: []};
+ titleToSamples[event.title].cpuDuration.push(event.cpuDuration);
+ titleToSamples[event.title].wallDuration.push(event.duration);
+ }
+
+ for (const [title, samples] of Object.entries(titleToSamples)) {
+ histograms.createHistogram(
+ FRAME_CYCLE_EVENTS.get(title).get('name') + ' (CPU Duration)',
benjhayden 2017/08/30 18:38:39 Histogram names should not contain spaces or paren
tiborg 2017/08/30 22:12:29 Done.
+ FRAME_CYCLE_EVENTS.get(title).get('unit'), samples.cpuDuration,
+ FRAME_CYCLE_EVENTS.get(title).get('options'));
+ histograms.createHistogram(
+ FRAME_CYCLE_EVENTS.get(title).get('name') + ' (Wall Duration)',
+ FRAME_CYCLE_EVENTS.get(title).get('unit'), samples.wallDuration,
+ FRAME_CYCLE_EVENTS.get(title).get('options'));
+ }
+ }
+
+ tr.metrics.MetricRegistry.register(frameCycleDurationMetric);
+
+ return {
+ frameCycleDurationMetric,
+ };
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698