| 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 from core import perf_benchmark | 5 from core import perf_benchmark |
| 6 | 6 |
| 7 from telemetry import benchmark | 7 from telemetry import benchmark |
| 8 from telemetry.page import legacy_page_test | 8 from telemetry.page import legacy_page_test |
| 9 from telemetry.timeline import chrome_trace_category_filter | 9 from telemetry.timeline import chrome_trace_category_filter |
| 10 from telemetry.value import list_of_scalar_values | 10 from telemetry.value import list_of_scalar_values |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 values=[float(v) for v in metrics[m]], | 33 values=[float(v) for v in metrics[m]], |
| 34 important=True)) | 34 important=True)) |
| 35 | 35 |
| 36 else: | 36 else: |
| 37 results.AddValue(scalar.ScalarValue( | 37 results.AddValue(scalar.ScalarValue( |
| 38 results.current_page, trace_name, units='ms', | 38 results.current_page, trace_name, units='ms', |
| 39 value=float(metrics[m]), important=True)) | 39 value=float(metrics[m]), important=True)) |
| 40 | 40 |
| 41 | 41 |
| 42 # android: See media.android.tough_video_cases below | 42 # android: See media.android.tough_video_cases below |
| 43 # crbug.com/565180: Only include cases that report time_to_play | |
| 44 @benchmark.Owner(emails=['crouleau@chromium.org'], | 43 @benchmark.Owner(emails=['crouleau@chromium.org'], |
| 45 component='Internals>Media') | 44 component='Internals>Media') |
| 46 @benchmark.Disabled('android') | 45 @benchmark.Disabled('android') |
| 47 class MediaToughVideoCases(perf_benchmark.PerfBenchmark): | 46 class MediaToughVideoCases(perf_benchmark.PerfBenchmark): |
| 48 """Obtains media metrics for key user scenarios.""" | 47 """Obtains media metrics for key user scenarios.""" |
| 49 test = media.Media | 48 test = media.Media |
| 50 page_set = page_sets.ToughVideoCasesPageSet | 49 page_set = page_sets.ToughVideoCasesPageSet |
| 51 | 50 |
| 52 @classmethod | 51 @classmethod |
| 53 def Name(cls): | 52 def Name(cls): |
| 54 return 'media.tough_video_cases' | 53 return 'media.tough_video_cases' |
| 55 | 54 |
| 56 | 55 |
| 56 @benchmark.Enabled('android') |
| 57 @benchmark.Disabled('l', 'android-webview') # WebView: crbug.com/419689. |
| 58 @benchmark.Owner(emails=['crouleau@chromium.org', 'videostack-eng@google.com'], |
| 59 component='Internals>Media') |
| 60 class MediaAndroidToughVideoCases(perf_benchmark.PerfBenchmark): |
| 61 """Obtains media metrics for key user scenarios on Android.""" |
| 62 test = media.Media |
| 63 tag = 'android' |
| 64 page_set = page_sets.ToughVideoCasesPageSet |
| 65 options = {'story_tag_filter_exclude': 'is_4k,is_50fps'} |
| 66 |
| 67 @classmethod |
| 68 def ShouldDisable(cls, possible_browser): |
| 69 return cls.IsSvelte(possible_browser) |
| 70 |
| 71 @classmethod |
| 72 def Name(cls): |
| 73 return 'media.android.tough_video_cases' |
| 74 |
| 75 |
| 57 class _MediaTBMv2Benchmark(perf_benchmark.PerfBenchmark): | 76 class _MediaTBMv2Benchmark(perf_benchmark.PerfBenchmark): |
| 58 page_set = page_sets.ToughVideoCasesPageSet | 77 page_set = page_sets.ToughVideoCasesPageSet |
| 59 | 78 |
| 60 def CreateTimelineBasedMeasurementOptions(self): | 79 def CreateTimelineBasedMeasurementOptions(self): |
| 61 category_filter = chrome_trace_category_filter.ChromeTraceCategoryFilter() | 80 category_filter = chrome_trace_category_filter.ChromeTraceCategoryFilter() |
| 62 | 81 |
| 63 # 'toplevel' category provides CPU time slices used by # cpuTimeMetric. | 82 # 'toplevel' category provides CPU time slices used by # cpuTimeMetric. |
| 64 category_filter.AddIncludedCategory('toplevel') | 83 category_filter.AddIncludedCategory('toplevel') |
| 65 | 84 |
| 66 # 'rail' category is used by powerMetric to attribute different period of | 85 # 'rail' category is used by powerMetric to attribute different period of |
| 67 # time to different activities, such as video_animation, etc. | 86 # time to different activities, such as video_animation, etc. |
| 68 category_filter.AddIncludedCategory('rail') | 87 category_filter.AddIncludedCategory('rail') |
| 69 | 88 |
| 70 options = timeline_based_measurement.Options(category_filter) | 89 options = timeline_based_measurement.Options(category_filter) |
| 71 options.config.enable_battor_trace = True | 90 options.config.enable_battor_trace = True |
| 72 options.SetTimelineBasedMetrics(['powerMetric', 'cpuTimeMetric']) | 91 options.SetTimelineBasedMetrics(['powerMetric', 'cpuTimeMetric']) |
| 73 return options | 92 return options |
| 74 | 93 |
| 75 | 94 |
| 95 # android: See media.android.tough_video_cases below |
| 76 @benchmark.Owner(emails=['johnchen@chromium.org', 'crouleau@chromium.org'], | 96 @benchmark.Owner(emails=['johnchen@chromium.org', 'crouleau@chromium.org'], |
| 77 component='Internals>Media') | 97 component='Internals>Media') |
| 78 @benchmark.Disabled('android') | 98 @benchmark.Disabled('android') |
| 79 class MediaToughVideoCasesTBMv2(_MediaTBMv2Benchmark): | 99 class MediaToughVideoCasesTBMv2(_MediaTBMv2Benchmark): |
| 80 """Obtains media metrics using TBMv2. | 100 """Obtains media metrics using TBMv2. |
| 81 Will eventually replace MediaToughVideoCases class.""" | 101 Will eventually replace MediaToughVideoCases class.""" |
| 82 | 102 |
| 83 @classmethod | 103 @classmethod |
| 84 def Name(cls): | 104 def Name(cls): |
| 85 return 'media.tough_video_cases_tbmv2' | 105 return 'media.tough_video_cases_tbmv2' |
| 86 | 106 |
| 87 | 107 |
| 88 # crbug.com/565180: Only include cases that don't report time_to_play | |
| 89 @benchmark.Disabled('android') | |
| 90 @benchmark.Owner(emails=['crouleau@chromium.org', 'videostack-eng@google.com'], | |
| 91 component='Internals>Media') | |
| 92 class MediaExtra(perf_benchmark.PerfBenchmark): | |
| 93 """Obtains extra media metrics for key user scenarios.""" | |
| 94 test = media.Media | |
| 95 page_set = page_sets.ToughVideoCasesExtraPageSet | |
| 96 | |
| 97 @classmethod | |
| 98 def Name(cls): | |
| 99 return 'media.tough_video_cases_extra' | |
| 100 | |
| 101 | |
| 102 @benchmark.Disabled('all') # crbug/676345 | |
| 103 @benchmark.Owner(emails=['crouleau@chromium.org', 'videostack-eng@google.com'], | |
| 104 component='Internals>Media') | |
| 105 class MediaNetworkSimulation(perf_benchmark.PerfBenchmark): | |
| 106 """Obtains media metrics under different network simulations.""" | |
| 107 test = media.Media | |
| 108 page_set = page_sets.MediaCnsCasesPageSet | |
| 109 | |
| 110 @classmethod | |
| 111 def Name(cls): | |
| 112 return 'media.media_cns_cases' | |
| 113 | |
| 114 | |
| 115 @benchmark.Disabled('l', 'android-webview') # WebView: crbug.com/419689. | |
| 116 @benchmark.Owner(emails=['crouleau@chromium.org', 'videostack-eng@google.com'], | |
| 117 component='Internals>Media') | |
| 118 class MediaAndroidToughVideoCases(perf_benchmark.PerfBenchmark): | |
| 119 """Obtains media metrics for key user scenarios on Android.""" | |
| 120 test = media.Media | |
| 121 tag = 'android' | |
| 122 page_set = page_sets.ToughVideoCasesPageSet | |
| 123 options = {'story_tag_filter_exclude': 'is_4k,is_50fps'} | |
| 124 | |
| 125 @classmethod | |
| 126 def ShouldDisable(cls, possible_browser): | |
| 127 if possible_browser.platform.GetOSName() != "android": | |
| 128 return True | |
| 129 return cls.IsSvelte(possible_browser) | |
| 130 | |
| 131 @classmethod | |
| 132 def Name(cls): | |
| 133 return 'media.android.tough_video_cases' | |
| 134 | |
| 135 | |
| 136 @benchmark.Owner(emails=['johnchen@chromium.org', 'crouleau@chromium.org'], | 108 @benchmark.Owner(emails=['johnchen@chromium.org', 'crouleau@chromium.org'], |
| 137 component='Internals>Media') | 109 component='Internals>Media') |
| 138 @benchmark.Enabled('android') | 110 @benchmark.Enabled('android') |
| 139 @benchmark.Disabled('l', 'android-webview') # WebView: crbug.com/419689. | 111 @benchmark.Disabled('l', 'android-webview') # WebView: crbug.com/419689. |
| 140 class MediaAndroidToughVideoCasesTBMv2(_MediaTBMv2Benchmark): | 112 class MediaAndroidToughVideoCasesTBMv2(_MediaTBMv2Benchmark): |
| 141 """Obtains media metrics for key user scenarios on Android using TBMv2. | 113 """Obtains media metrics for key user scenarios on Android using TBMv2. |
| 142 Will eventually replace MediaAndroidToughVideoCases class.""" | 114 Will eventually replace MediaAndroidToughVideoCases class.""" |
| 143 | 115 |
| 144 tag = 'android' | 116 tag = 'android' |
| 145 options = {'story_tag_filter_exclude': 'is_4k,is_50fps'} | 117 options = {'story_tag_filter_exclude': 'is_4k,is_50fps'} |
| (...skipping 13 matching lines...) Expand all Loading... |
| 159 # Note that both of these flags should be used until every build from | 131 # Note that both of these flags should be used until every build from |
| 160 # ToT to Stable switches over to one flag or another. This is to support | 132 # ToT to Stable switches over to one flag or another. This is to support |
| 161 # reference builds. | 133 # reference builds. |
| 162 # --disable-gesture-requirement-for-media-playback is the old one and can be | 134 # --disable-gesture-requirement-for-media-playback is the old one and can be |
| 163 # removed after M60 goes to stable. | 135 # removed after M60 goes to stable. |
| 164 options.AppendExtraBrowserArgs( | 136 options.AppendExtraBrowserArgs( |
| 165 ['--ignore-autoplay-restrictions', | 137 ['--ignore-autoplay-restrictions', |
| 166 '--disable-gesture-requirement-for-media-playback']) | 138 '--disable-gesture-requirement-for-media-playback']) |
| 167 | 139 |
| 168 | 140 |
| 169 # This isn't running anywhere. See crbug/709161. | 141 @benchmark.Disabled('all') # crbug/676345 |
| 170 @benchmark.Enabled('chromeos') | 142 @benchmark.Owner(emails=['crouleau@chromium.org', 'videostack-eng@google.com'], |
| 171 @benchmark.Owner(emails=['crouleau@chromium.org'], | |
| 172 component='Internals>Media') | 143 component='Internals>Media') |
| 173 class MediaChromeOS4kOnly(perf_benchmark.PerfBenchmark): | 144 class MediaNetworkSimulation(perf_benchmark.PerfBenchmark): |
| 174 """Benchmark for media performance on ChromeOS using only is_4k test content. | 145 """Obtains media metrics under different network simulations.""" |
| 175 """ | |
| 176 test = media.Media | 146 test = media.Media |
| 177 tag = 'chromeOS4kOnly' | 147 page_set = page_sets.MediaCnsCasesPageSet |
| 178 page_set = page_sets.ToughVideoCasesPageSet | |
| 179 options = { | |
| 180 'story_tag_filter': 'is_4k', | |
| 181 # Exclude is_50fps test files: crbug/331816 | |
| 182 'story_tag_filter_exclude': 'is_50fps' | |
| 183 } | |
| 184 | 148 |
| 185 @classmethod | 149 @classmethod |
| 186 def Name(cls): | 150 def Name(cls): |
| 187 return 'media.chromeOS4kOnly.tough_video_cases' | 151 return 'media.media_cns_cases' |
| 188 | |
| 189 | |
| 190 # This isn't running anywhere. See crbug/709161. | |
| 191 @benchmark.Enabled('chromeos') | |
| 192 @benchmark.Owner(emails=['crouleau@chromium.org'], | |
| 193 component='Internals>Media') | |
| 194 class MediaChromeOS(perf_benchmark.PerfBenchmark): | |
| 195 """Benchmark for media performance on all ChromeOS platforms. | |
| 196 | |
| 197 This benchmark does not run is_4k content, there's a separate benchmark for | |
| 198 that. | |
| 199 """ | |
| 200 test = media.Media | |
| 201 tag = 'chromeOS' | |
| 202 page_set = page_sets.ToughVideoCasesPageSet | |
| 203 # Exclude is_50fps test files: crbug/331816 | |
| 204 options = {'story_tag_filter_exclude': 'is_4k,is_50fps'} | |
| 205 | |
| 206 @classmethod | |
| 207 def Name(cls): | |
| 208 return 'media.chromeOS.tough_video_cases' | |
| 209 | 152 |
| 210 | 153 |
| 211 @benchmark.Disabled('android-webview') # crbug.com/419689 | 154 @benchmark.Disabled('android-webview') # crbug.com/419689 |
| 212 @benchmark.Owner(emails=['crouleau@chromium.org', 'videostack-eng@google.com'], | 155 @benchmark.Owner(emails=['crouleau@chromium.org', 'videostack-eng@google.com'], |
| 213 component='Internals>Media>Source') | 156 component='Internals>Media>Source') |
| 214 class MediaSourceExtensions(perf_benchmark.PerfBenchmark): | 157 class MediaSourceExtensions(perf_benchmark.PerfBenchmark): |
| 215 """Obtains media metrics for key media source extensions functions.""" | 158 """Obtains media metrics for key media source extensions functions.""" |
| 216 test = _MSEMeasurement | 159 test = _MSEMeasurement |
| 217 page_set = page_sets.MseCasesPageSet | 160 page_set = page_sets.MseCasesPageSet |
| 218 | 161 |
| 219 @classmethod | 162 @classmethod |
| 220 def Name(cls): | 163 def Name(cls): |
| 221 return 'media.mse_cases' | 164 return 'media.mse_cases' |
| 222 | 165 |
| 223 def SetExtraBrowserOptions(self, options): | 166 def SetExtraBrowserOptions(self, options): |
| 224 # Needed to allow XHR requests to return stream objects. | 167 # Needed to allow XHR requests to return stream objects. |
| 225 options.AppendExtraBrowserArgs( | 168 options.AppendExtraBrowserArgs( |
| 226 ['--enable-experimental-web-platform-features', | 169 ['--enable-experimental-web-platform-features', |
| 227 '--ignore-autoplay-restrictions']) | 170 '--ignore-autoplay-restrictions']) |
| OLD | NEW |