| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import re |
| 6 |
| 5 from core import perf_benchmark | 7 from core import perf_benchmark |
| 6 | 8 |
| 7 from telemetry import benchmark | 9 from telemetry import benchmark |
| 8 from telemetry.page import legacy_page_test | 10 from telemetry.page import legacy_page_test |
| 9 from telemetry.timeline import chrome_trace_category_filter | 11 from telemetry.timeline import chrome_trace_category_filter |
| 10 from telemetry.timeline import chrome_trace_config | 12 from telemetry.timeline import chrome_trace_config |
| 11 from telemetry.value import list_of_scalar_values | 13 from telemetry.value import list_of_scalar_values |
| 12 from telemetry.value import scalar | 14 from telemetry.value import scalar |
| 13 from telemetry.web_perf import timeline_based_measurement | 15 from telemetry.web_perf import timeline_based_measurement |
| 14 | 16 |
| 15 from measurements import media | 17 from measurements import media |
| 16 import page_sets | 18 import page_sets |
| 17 | 19 |
| 18 | 20 |
| 21 # See tr.v.Numeric.getSummarizedScalarNumericsWithNames() |
| 22 # https://github.com/catapult-project/catapult/blob/master/tracing/tracing/value
/numeric.html#L323 |
| 23 _IGNORED_STATS_RE = re.compile( |
| 24 r'(?<!dump)(?<!process)_(std|count|max|min|sum|pct_\d{4}(_\d+)?)$') |
| 25 |
| 26 |
| 19 class _MSEMeasurement(legacy_page_test.LegacyPageTest): | 27 class _MSEMeasurement(legacy_page_test.LegacyPageTest): |
| 20 | 28 |
| 21 def __init__(self): | 29 def __init__(self): |
| 22 super(_MSEMeasurement, self).__init__() | 30 super(_MSEMeasurement, self).__init__() |
| 23 | 31 |
| 24 def ValidateAndMeasurePage(self, page, tab, results): | 32 def ValidateAndMeasurePage(self, page, tab, results): |
| 25 del page # unused | 33 del page # unused |
| 26 media_metric = tab.EvaluateJavaScript('window.__testMetrics') | 34 media_metric = tab.EvaluateJavaScript('window.__testMetrics') |
| 27 trace = media_metric['id'] if 'id' in media_metric else None | 35 trace = media_metric['id'] if 'id' in media_metric else None |
| 28 metrics = media_metric['metrics'] if 'metrics' in media_metric else [] | 36 metrics = media_metric['metrics'] if 'metrics' in media_metric else [] |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 component='Internals>Media') | 117 component='Internals>Media') |
| 110 @benchmark.Disabled('android') | 118 @benchmark.Disabled('android') |
| 111 class MediaToughVideoCasesTBMv2(_MediaTBMv2Benchmark): | 119 class MediaToughVideoCasesTBMv2(_MediaTBMv2Benchmark): |
| 112 """Obtains media metrics using TBMv2. | 120 """Obtains media metrics using TBMv2. |
| 113 Will eventually replace MediaToughVideoCases class.""" | 121 Will eventually replace MediaToughVideoCases class.""" |
| 114 | 122 |
| 115 @classmethod | 123 @classmethod |
| 116 def Name(cls): | 124 def Name(cls): |
| 117 return 'media.tough_video_cases_tbmv2' | 125 return 'media.tough_video_cases_tbmv2' |
| 118 | 126 |
| 127 @classmethod |
| 128 def ValueCanBeAddedPredicate(cls, value, is_first_result): |
| 129 # TODO(crbug.com/610962): Remove this stopgap when the perf dashboard |
| 130 # is able to cope with the data load generated by TBMv2 metrics. |
| 131 return not _IGNORED_STATS_RE.search(value.name) |
| 132 |
| 119 | 133 |
| 120 @benchmark.Owner(emails=['johnchen@chromium.org', 'crouleau@chromium.org'], | 134 @benchmark.Owner(emails=['johnchen@chromium.org', 'crouleau@chromium.org'], |
| 121 component='Internals>Media') | 135 component='Internals>Media') |
| 122 @benchmark.Enabled('android') | 136 @benchmark.Enabled('android') |
| 123 @benchmark.Disabled('l', 'android-webview') # WebView: crbug.com/419689. | 137 @benchmark.Disabled('l', 'android-webview') # WebView: crbug.com/419689. |
| 124 class MediaAndroidToughVideoCasesTBMv2(_MediaTBMv2Benchmark): | 138 class MediaAndroidToughVideoCasesTBMv2(_MediaTBMv2Benchmark): |
| 125 """Obtains media metrics for key user scenarios on Android using TBMv2. | 139 """Obtains media metrics for key user scenarios on Android using TBMv2. |
| 126 Will eventually replace MediaAndroidToughVideoCases class.""" | 140 Will eventually replace MediaAndroidToughVideoCases class.""" |
| 127 | 141 |
| 128 tag = 'android' | 142 tag = 'android' |
| (...skipping 13 matching lines...) Expand all Loading... |
| 142 # The following option works around that. | 156 # The following option works around that. |
| 143 # Note that both of these flags should be used until every build from | 157 # Note that both of these flags should be used until every build from |
| 144 # ToT to Stable switches over to one flag or another. This is to support | 158 # ToT to Stable switches over to one flag or another. This is to support |
| 145 # reference builds. | 159 # reference builds. |
| 146 # --disable-gesture-requirement-for-media-playback is the old one and can be | 160 # --disable-gesture-requirement-for-media-playback is the old one and can be |
| 147 # removed after M60 goes to stable. | 161 # removed after M60 goes to stable. |
| 148 options.AppendExtraBrowserArgs( | 162 options.AppendExtraBrowserArgs( |
| 149 ['--ignore-autoplay-restrictions', | 163 ['--ignore-autoplay-restrictions', |
| 150 '--disable-gesture-requirement-for-media-playback']) | 164 '--disable-gesture-requirement-for-media-playback']) |
| 151 | 165 |
| 166 @classmethod |
| 167 def ValueCanBeAddedPredicate(cls, value, is_first_result): |
| 168 # TODO(crbug.com/610962): Remove this stopgap when the perf dashboard |
| 169 # is able to cope with the data load generated by TBMv2 metrics. |
| 170 return not _IGNORED_STATS_RE.search(value.name) |
| 171 |
| 152 | 172 |
| 153 @benchmark.Disabled('all') # crbug/676345 | 173 @benchmark.Disabled('all') # crbug/676345 |
| 154 @benchmark.Owner(emails=['crouleau@chromium.org', 'videostack-eng@google.com'], | 174 @benchmark.Owner(emails=['crouleau@chromium.org', 'videostack-eng@google.com'], |
| 155 component='Internals>Media') | 175 component='Internals>Media') |
| 156 class MediaNetworkSimulation(perf_benchmark.PerfBenchmark): | 176 class MediaNetworkSimulation(perf_benchmark.PerfBenchmark): |
| 157 """Obtains media metrics under different network simulations.""" | 177 """Obtains media metrics under different network simulations.""" |
| 158 test = media.Media | 178 test = media.Media |
| 159 page_set = page_sets.MediaCnsCasesPageSet | 179 page_set = page_sets.MediaCnsCasesPageSet |
| 160 | 180 |
| 161 @classmethod | 181 @classmethod |
| (...skipping 11 matching lines...) Expand all Loading... |
| 173 | 193 |
| 174 @classmethod | 194 @classmethod |
| 175 def Name(cls): | 195 def Name(cls): |
| 176 return 'media.mse_cases' | 196 return 'media.mse_cases' |
| 177 | 197 |
| 178 def SetExtraBrowserOptions(self, options): | 198 def SetExtraBrowserOptions(self, options): |
| 179 # Needed to allow XHR requests to return stream objects. | 199 # Needed to allow XHR requests to return stream objects. |
| 180 options.AppendExtraBrowserArgs( | 200 options.AppendExtraBrowserArgs( |
| 181 ['--enable-experimental-web-platform-features', | 201 ['--enable-experimental-web-platform-features', |
| 182 '--ignore-autoplay-restrictions']) | 202 '--ignore-autoplay-restrictions']) |
| OLD | NEW |