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

Unified Diff: tracing/tracing/metrics/media_metric.html

Issue 2996233004: Port a media metric to TBMv2 (Closed)
Patch Set: mediaMetric: Look in renderer only; add tests 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/media_metric_test.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tracing/tracing/metrics/media_metric.html
diff --git a/tracing/tracing/metrics/media_metric.html b/tracing/tracing/metrics/media_metric.html
new file mode 100644
index 0000000000000000000000000000000000000000..53d13310abf7f3030675ed94257e8e2eda071e42
--- /dev/null
+++ b/tracing/tracing/metrics/media_metric.html
@@ -0,0 +1,75 @@
+<!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.
+-->
+
+<!--
+media_metrics uses Chrome trace events to calculate metrics about video
+and audio playback. It is meant to be used for pages with a <video> or
+<audio> element. It is used by videostack-eng@google.com team for
+regression testing.
+
+This metric currently supports the following measurement:
+* time_to_play calculates how long after a video is requested to
+ start playing before the video actually starts. If time_to_play
+ regresses, then users will click to play videos and then have
+ to wait longer before the videos start actually playing.
+
+More measurements are expected to be added in the near future, such as:
+* buffering_time
+* seek_time
+* dropped_frame_count
+
+Please inform crouleau@chromium.org and johnchen@chromium.org about
+changes to this file.
+-->
+
+<link rel="import" href="/tracing/metrics/metric_registry.html">
+<link rel="import" href="/tracing/model/helpers/chrome_model_helper.html">
+<link rel="import" href="/tracing/value/histogram.html">
+
+<script>
+'use strict';
+
+tr.exportTo('tr.metrics', function() {
+ function mediaMetric(histograms, model) {
+ let playStart;
+ let timeToPlay;
+
+ const chromeHelper = model.getOrCreateHelper(
+ tr.model.helpers.ChromeModelHelper);
+ if (chromeHelper === undefined) return;
+ for (const rendererHelper of Object.values(chromeHelper.rendererHelpers)) {
+ for (const event of rendererHelper.process.getDescendantEvents()) {
benjhayden 2017/08/29 23:17:25 Thanks, this is good, keep going. Which thread[s]
johnchen 2017/08/30 01:39:19 The code now looks for the events on specific thre
+ if (event.title === 'WebMediaPlayerImpl::DoLoad') {
+ if (playStart === undefined) {
+ playStart = event.start;
+ }
+ } else if (event.title === 'VideoRendererImpl::Render' ||
+ event.title === 'AudioRendererImpl::Render') {
+ if (playStart !== undefined && timeToPlay === undefined) {
+ timeToPlay = event.start - playStart;
+ break;
benjhayden 2017/08/29 23:17:25 We try to make metrics as general as possible in o
johnchen 2017/08/30 01:39:19 The Render events are raised for each video frame.
+ }
+ }
+ }
+ if (timeToPlay !== undefined) {
+ break;
+ }
+ }
+
+ if (timeToPlay !== undefined) {
+ histograms.createHistogram('time_to_play',
+ tr.b.Unit.byName.timeDurationInMs_smallerIsBetter, timeToPlay);
+ }
+ }
+
+ tr.metrics.MetricRegistry.register(mediaMetric);
+
+ return {
+ mediaMetric,
+ };
+});
+</script>
« no previous file with comments | « tracing/tracing/metrics/all_metrics.html ('k') | tracing/tracing/metrics/media_metric_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698