Chromium Code Reviews| 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.Disabled('l', 'android-webview') # WebView: crbug.com/419689. | |
| 57 @benchmark.Owner(emails=['crouleau@chromium.org', 'videostack-eng@google.com'], | |
| 58 component='Internals>Media') | |
| 59 class MediaAndroidToughVideoCases(perf_benchmark.PerfBenchmark): | |
| 60 """Obtains media metrics for key user scenarios on Android.""" | |
| 61 test = media.Media | |
| 62 tag = 'android' | |
| 63 page_set = page_sets.ToughVideoCasesPageSet | |
| 64 options = {'story_tag_filter_exclude': 'is_4k,is_50fps'} | |
| 65 | |
| 66 @classmethod | |
| 67 def ShouldDisable(cls, possible_browser): | |
| 68 if possible_browser.platform.GetOSName() != "android": | |
|
nednguyen
2017/05/05 21:38:50
can you refactor 68 & 69 to "@benchmark.Disabled('
CalebRouleau
2017/05/06 05:48:19
Done.
| |
| 69 return True | |
| 70 return cls.IsSvelte(possible_browser) | |
| 71 | |
| 72 @classmethod | |
| 73 def Name(cls): | |
| 74 return 'media.android.tough_video_cases' | |
| 75 | |
| 76 | |
| 57 class _MediaTBMv2Benchmark(perf_benchmark.PerfBenchmark): | 77 class _MediaTBMv2Benchmark(perf_benchmark.PerfBenchmark): |
| 58 page_set = page_sets.ToughVideoCasesPageSet | 78 page_set = page_sets.ToughVideoCasesPageSet |
| 59 | 79 |
| 60 def CreateTimelineBasedMeasurementOptions(self): | 80 def CreateTimelineBasedMeasurementOptions(self): |
| 61 category_filter = chrome_trace_category_filter.ChromeTraceCategoryFilter() | 81 category_filter = chrome_trace_category_filter.ChromeTraceCategoryFilter() |
| 62 | 82 |
| 63 # 'toplevel' category provides CPU time slices used by # cpuTimeMetric. | 83 # 'toplevel' category provides CPU time slices used by # cpuTimeMetric. |
| 64 category_filter.AddIncludedCategory('toplevel') | 84 category_filter.AddIncludedCategory('toplevel') |
| 65 | 85 |
| 66 # 'rail' category is used by powerMetric to attribute different period of | 86 # 'rail' category is used by powerMetric to attribute different period of |
| 67 # time to different activities, such as video_animation, etc. | 87 # time to different activities, such as video_animation, etc. |
| 68 category_filter.AddIncludedCategory('rail') | 88 category_filter.AddIncludedCategory('rail') |
| 69 | 89 |
| 70 options = timeline_based_measurement.Options(category_filter) | 90 options = timeline_based_measurement.Options(category_filter) |
| 71 options.config.enable_battor_trace = True | 91 options.config.enable_battor_trace = True |
| 72 options.SetTimelineBasedMetrics(['powerMetric', 'cpuTimeMetric']) | 92 options.SetTimelineBasedMetrics(['powerMetric', 'cpuTimeMetric']) |
| 73 return options | 93 return options |
| 74 | 94 |
| 75 | 95 |
| 96 # android: See media.android.tough_video_cases below | |
| 76 @benchmark.Owner(emails=['johnchen@chromium.org', 'crouleau@chromium.org'], | 97 @benchmark.Owner(emails=['johnchen@chromium.org', 'crouleau@chromium.org'], |
| 77 component='Internals>Media') | 98 component='Internals>Media') |
| 78 @benchmark.Disabled('android') | 99 @benchmark.Disabled('android') |
| 79 class MediaToughVideoCasesTBMv2(_MediaTBMv2Benchmark): | 100 class MediaToughVideoCasesTBMv2(_MediaTBMv2Benchmark): |
| 80 """Obtains media metrics using TBMv2. | 101 """Obtains media metrics using TBMv2. |
| 81 Will eventually replace MediaToughVideoCases class.""" | 102 Will eventually replace MediaToughVideoCases class.""" |
| 82 | 103 |
| 83 @classmethod | 104 @classmethod |
| 84 def Name(cls): | 105 def Name(cls): |
| 85 return 'media.tough_video_cases_tbmv2' | 106 return 'media.tough_video_cases_tbmv2' |
| 86 | 107 |
| 87 | 108 |
| 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'], | 109 @benchmark.Owner(emails=['johnchen@chromium.org', 'crouleau@chromium.org'], |
| 137 component='Internals>Media') | 110 component='Internals>Media') |
| 138 @benchmark.Enabled('android') | 111 @benchmark.Enabled('android') |
| 139 @benchmark.Disabled('l', 'android-webview') # WebView: crbug.com/419689. | 112 @benchmark.Disabled('l', 'android-webview') # WebView: crbug.com/419689. |
| 140 class MediaAndroidToughVideoCasesTBMv2(_MediaTBMv2Benchmark): | 113 class MediaAndroidToughVideoCasesTBMv2(_MediaTBMv2Benchmark): |
| 141 """Obtains media metrics for key user scenarios on Android using TBMv2. | 114 """Obtains media metrics for key user scenarios on Android using TBMv2. |
| 142 Will eventually replace MediaAndroidToughVideoCases class.""" | 115 Will eventually replace MediaAndroidToughVideoCases class.""" |
| 143 | 116 |
| 144 tag = 'android' | 117 tag = 'android' |
| 145 options = {'story_tag_filter_exclude': 'is_4k,is_50fps'} | 118 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 | 132 # 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 | 133 # ToT to Stable switches over to one flag or another. This is to support |
| 161 # reference builds. | 134 # reference builds. |
| 162 # --disable-gesture-requirement-for-media-playback is the old one and can be | 135 # --disable-gesture-requirement-for-media-playback is the old one and can be |
| 163 # removed after M60 goes to stable. | 136 # removed after M60 goes to stable. |
| 164 options.AppendExtraBrowserArgs( | 137 options.AppendExtraBrowserArgs( |
| 165 ['--ignore-autoplay-restrictions', | 138 ['--ignore-autoplay-restrictions', |
| 166 '--disable-gesture-requirement-for-media-playback']) | 139 '--disable-gesture-requirement-for-media-playback']) |
| 167 | 140 |
| 168 | 141 |
| 169 # This isn't running anywhere. See crbug/709161. | 142 @benchmark.Disabled('all') # crbug/676345 |
| 170 @benchmark.Enabled('chromeos') | 143 @benchmark.Owner(emails=['crouleau@chromium.org', 'videostack-eng@google.com'], |
| 171 @benchmark.Owner(emails=['crouleau@chromium.org'], | |
| 172 component='Internals>Media') | 144 component='Internals>Media') |
| 173 class MediaChromeOS4kOnly(perf_benchmark.PerfBenchmark): | 145 class MediaNetworkSimulation(perf_benchmark.PerfBenchmark): |
| 174 """Benchmark for media performance on ChromeOS using only is_4k test content. | 146 """Obtains media metrics under different network simulations.""" |
| 175 """ | |
| 176 test = media.Media | 147 test = media.Media |
| 177 tag = 'chromeOS4kOnly' | 148 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 | 149 |
| 185 @classmethod | 150 @classmethod |
| 186 def Name(cls): | 151 def Name(cls): |
| 187 return 'media.chromeOS4kOnly.tough_video_cases' | 152 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 | 153 |
| 210 | 154 |
| 211 @benchmark.Disabled('android-webview') # crbug.com/419689 | 155 @benchmark.Disabled('android-webview') # crbug.com/419689 |
| 212 @benchmark.Owner(emails=['crouleau@chromium.org', 'videostack-eng@google.com'], | 156 @benchmark.Owner(emails=['crouleau@chromium.org', 'videostack-eng@google.com'], |
| 213 component='Internals>Media>Source') | 157 component='Internals>Media>Source') |
| 214 class MediaSourceExtensions(perf_benchmark.PerfBenchmark): | 158 class MediaSourceExtensions(perf_benchmark.PerfBenchmark): |
| 215 """Obtains media metrics for key media source extensions functions.""" | 159 """Obtains media metrics for key media source extensions functions.""" |
| 216 test = _MSEMeasurement | 160 test = _MSEMeasurement |
| 217 page_set = page_sets.MseCasesPageSet | 161 page_set = page_sets.MseCasesPageSet |
| 218 | 162 |
| 219 @classmethod | 163 @classmethod |
| 220 def Name(cls): | 164 def Name(cls): |
| 221 return 'media.mse_cases' | 165 return 'media.mse_cases' |
| 222 | 166 |
| 223 def SetExtraBrowserOptions(self, options): | 167 def SetExtraBrowserOptions(self, options): |
| 224 # Needed to allow XHR requests to return stream objects. | 168 # Needed to allow XHR requests to return stream objects. |
| 225 options.AppendExtraBrowserArgs( | 169 options.AppendExtraBrowserArgs( |
| 226 ['--enable-experimental-web-platform-features', | 170 ['--enable-experimental-web-platform-features', |
| 227 '--ignore-autoplay-restrictions']) | 171 '--ignore-autoplay-restrictions']) |
| OLD | NEW |