File: media.py

package info (click to toggle)
chromium 138.0.7204.157-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 6,071,864 kB
  • sloc: cpp: 34,936,859; ansic: 7,176,967; javascript: 4,110,704; python: 1,419,953; asm: 946,768; xml: 739,967; pascal: 187,324; sh: 89,623; perl: 88,663; objc: 79,944; sql: 50,304; cs: 41,786; fortran: 24,137; makefile: 21,806; php: 13,980; tcl: 13,166; yacc: 8,925; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (107 lines) | stat: -rw-r--r-- 4,241 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# Copyright 2014 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

from core import perf_benchmark
from core import platforms

from telemetry import benchmark
from telemetry import story
from telemetry.timeline import chrome_trace_category_filter
from telemetry.timeline import chrome_trace_config
from telemetry.web_perf import timeline_based_measurement

import page_sets


# TODO(rnephew): Revisit the re-enabled benchmarks on Wed, Aug 8 2017.


class _MediaBenchmark(perf_benchmark.PerfBenchmark):
  """Base class for TBMv2-based media benchmarks (MediaDesktop and
  MediaMobile)."""

  def CreateCoreTimelineBasedMeasurementOptions(self):
    category_filter = chrome_trace_category_filter.ChromeTraceCategoryFilter()

    # 'toplevel' category provides CPU time slices used by # cpuTimeMetric.
    category_filter.AddIncludedCategory('toplevel')

    # Collect media related events required by mediaMetric.
    category_filter.AddIncludedCategory('media')

    # Collect memory data.
    category_filter.AddDisabledByDefault('disabled-by-default-memory-infra')

    options = timeline_based_measurement.Options(category_filter)
    options.config.enable_android_graphics_memtrack = True

    # Setting an empty memory dump config disables periodic dumps.
    options.config.chrome_trace_config.SetMemoryDumpConfig(
        chrome_trace_config.MemoryDumpConfig())

    # Note that memoryMetric is added using GetExtraTracingMetrics() for
    # certain stories.
    options.SetTimelineBasedMetrics(['mediaMetric', 'cpuTimeMetric'])
    return options

  def SetExtraBrowserOptions(self, options):
    # bf-cache messes with the time_to_play numbers when we do several runs
    # in a row. More info crbug.com/1309294
    options.AppendExtraBrowserArgs('--disable-features=BackForwardCache')


@benchmark.Info(emails=['dalecurtis@chromium.org'],
                component='Internals>Media',
                documentation_url='https://chromium.googlesource.com/chromium/src/+/main/docs/speed/benchmark/harnesses/media.md')  # pylint: disable=line-too-long
class MediaDesktop(_MediaBenchmark):
  """Obtains media performance for key user scenarios on desktop."""
  # TODO(johnchen): Remove either the SUPPORTED_PLATFORMS or
  # SUPPORTED_PLATFORMS_TAGS lists. Only one is necessary.
  SUPPORTED_PLATFORM_TAGS = [platforms.DESKTOP]
  SUPPORTED_PLATFORMS = [story.expectations.ALL_DESKTOP]

  def CreateStorySet(self, options):
    return page_sets.MediaCasesDesktopStorySet()

  @classmethod
  def Name(cls):
    return 'media.desktop'


# If any story is failing on svelte, please only disable on svelte.
@benchmark.Info(emails=['dalecurtis@chromium.org'],
                component='Internals>Media',
                documentation_url='https://chromium.googlesource.com/chromium/src/+/main/docs/speed/benchmark/harnesses/media.md')  # pylint: disable=line-too-long
class MediaMobile(_MediaBenchmark):
  """Obtains media performance for key user scenarios on mobile devices."""

  # TODO(johnchen): Remove either the SUPPORTED_PLATFORMS or
  # SUPPORTED_PLATFORMS_TAGS lists. Only one is necessary.
  SUPPORTED_PLATFORM_TAGS = [
      platforms.ANDROID_NOT_WEBVIEW, platforms.FUCHSIA_ASTRO,
      platforms.FUCHSIA_SHERLOCK
  ]
  SUPPORTED_PLATFORMS = [
      story.expectations.ANDROID_NOT_WEBVIEW, story.expectations.FUCHSIA_ASTRO,
      story.expectations.FUCHSIA_SHERLOCK, story.expectations.FUCHSIA_NELSON
  ]

  def CreateStorySet(self, options):
    return page_sets.MediaCasesMobileStorySet()

  @classmethod
  def Name(cls):
    return 'media.mobile'

  def SetExtraBrowserOptions(self, options):
    super(MediaMobile, self).SetExtraBrowserOptions(options)
    # By default, Chrome on Android does not allow autoplay
    # of media: it requires a user gesture event to start a video.
    # The following option works around that.
    options.AppendExtraBrowserArgs(
        ['--autoplay-policy=no-user-gesture-required'])
    # Force online state for the offline indicator so it doesn't show and affect
    # the benchmarks on bots, which are offline by default.
    options.AppendExtraBrowserArgs(
        '--force-online-connection-state-for-indicator')