| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 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 import page_sets | 6 import page_sets |
| 7 | 7 |
| 8 import ct_benchmarks_util | 8 import ct_benchmarks_util |
| 9 from benchmarks import page_cycler_v2 | 9 from benchmarks import page_cycler_v2 |
| 10 from telemetry import benchmark | 10 from telemetry import benchmark |
| 11 from telemetry.page import cache_temperature | 11 from telemetry.page import cache_temperature |
| 12 from telemetry.page import traffic_setting | 12 from telemetry.page import traffic_setting |
| 13 from telemetry.web_perf import timeline_based_measurement | 13 from telemetry.web_perf import timeline_based_measurement |
| 14 | 14 |
| 15 | 15 |
| 16 @benchmark.Enabled('android') | 16 class _LoadingBase(perf_benchmark.PerfBenchmark): |
| 17 @benchmark.Owner(emails=['kouhei@chromium.org', 'ksakamoto@chromium.org']) | 17 """ A base class for loading benchmarks. """ |
| 18 class LoadingMobile(perf_benchmark.PerfBenchmark): | |
| 19 """ A benchmark measuring loading performance of mobile sites. """ | |
| 20 | 18 |
| 21 options = {'pageset_repeat': 2} | 19 options = {'pageset_repeat': 2} |
| 22 | 20 |
| 23 def CreateTimelineBasedMeasurementOptions(self): | 21 def CreateTimelineBasedMeasurementOptions(self): |
| 24 tbm_options = timeline_based_measurement.Options() | 22 tbm_options = timeline_based_measurement.Options() |
| 25 page_cycler_v2.AugmentOptionsForLoadingMetrics(tbm_options) | 23 page_cycler_v2.AugmentOptionsForLoadingMetrics(tbm_options) |
| 26 return tbm_options | 24 return tbm_options |
| 27 | 25 |
| 26 |
| 27 @benchmark.Enabled('android') |
| 28 @benchmark.Owner(emails=['kouhei@chromium.org', 'ksakamoto@chromium.org']) |
| 29 class LoadingMobile(_LoadingBase): |
| 30 """ A benchmark measuring loading performance of mobile sites. """ |
| 31 |
| 28 @classmethod | 32 @classmethod |
| 29 def ShouldDisable(cls, possible_browser): | 33 def ShouldDisable(cls, possible_browser): |
| 30 # crbug.com/619254 | 34 # crbug.com/619254 |
| 31 if possible_browser.browser_type == 'reference': | 35 if possible_browser.browser_type == 'reference': |
| 32 return True | 36 return True |
| 33 | 37 |
| 34 # crbug.com/676612 | 38 # crbug.com/676612 |
| 35 if ((possible_browser.platform.GetDeviceTypeName() == 'Nexus 6' or | 39 if ((possible_browser.platform.GetDeviceTypeName() == 'Nexus 6' or |
| 36 possible_browser.platform.GetDeviceTypeName() == 'AOSP on Shamu') and | 40 possible_browser.platform.GetDeviceTypeName() == 'AOSP on Shamu') and |
| 37 possible_browser.browser_type == 'android-webview'): | 41 possible_browser.browser_type == 'android-webview'): |
| 38 return True | 42 return True |
| 39 | 43 |
| 40 return False | 44 return False |
| 41 | 45 |
| 42 @classmethod | 46 @classmethod |
| 43 def Name(cls): | 47 def Name(cls): |
| 44 return 'loading.mobile' | 48 return 'loading.mobile' |
| 45 | 49 |
| 46 def CreateStorySet(self, options): | 50 def CreateStorySet(self, options): |
| 47 return page_sets.LoadingMobileStorySet( | 51 return page_sets.LoadingMobileStorySet( |
| 48 cache_temperatures=[cache_temperature.ANY], | 52 cache_temperatures=[cache_temperature.ANY], |
| 49 traffic_settings=[traffic_setting.NONE, traffic_setting.REGULAR_3G]) | 53 traffic_settings=[traffic_setting.NONE, traffic_setting.REGULAR_3G]) |
| 50 | 54 |
| 51 | 55 |
| 52 # Disabled because we do not plan on running CT benchmarks on the perf | 56 # Disabled because we do not plan on running CT benchmarks on the perf |
| 53 # waterfall any time soon. | 57 # waterfall any time soon. |
| 54 @benchmark.Disabled('all') | 58 @benchmark.Disabled('all') |
| 55 class LoadingClusterTelemetry(perf_benchmark.PerfBenchmark): | 59 class LoadingClusterTelemetry(_LoadingBase): |
| 56 | 60 |
| 57 options = {'upload_results': True} | 61 options = {'upload_results': True} |
| 58 | 62 |
| 59 _ALL_NET_CONFIGS = traffic_setting.NETWORK_CONFIGS.keys() | 63 _ALL_NET_CONFIGS = traffic_setting.NETWORK_CONFIGS.keys() |
| 60 | 64 |
| 61 def CreateTimelineBasedMeasurementOptions(self): | |
| 62 tbm_options = timeline_based_measurement.Options() | |
| 63 page_cycler_v2.AugmentOptionsForLoadingMetrics(tbm_options) | |
| 64 return tbm_options | |
| 65 | |
| 66 @classmethod | 65 @classmethod |
| 67 def Name(cls): | 66 def Name(cls): |
| 68 return 'loading.cluster_telemetry' | 67 return 'loading.cluster_telemetry' |
| 69 | 68 |
| 70 @classmethod | 69 @classmethod |
| 71 def AddBenchmarkCommandLineArgs(cls, parser): | 70 def AddBenchmarkCommandLineArgs(cls, parser): |
| 72 super(LoadingClusterTelemetry, cls).AddBenchmarkCommandLineArgs(parser) | 71 super(LoadingClusterTelemetry, cls).AddBenchmarkCommandLineArgs(parser) |
| 73 ct_benchmarks_util.AddBenchmarkCommandLineArgs(parser) | 72 ct_benchmarks_util.AddBenchmarkCommandLineArgs(parser) |
| 74 parser.add_option( | 73 parser.add_option( |
| 75 '--wait-time', action='store', type='int', | 74 '--wait-time', action='store', type='int', |
| 76 default=60, help='Number of seconds to wait for after navigation.') | 75 default=60, help='Number of seconds to wait for after navigation.') |
| 77 parser.add_option( | 76 parser.add_option( |
| 78 '--traffic-setting', choices=cls._ALL_NET_CONFIGS, | 77 '--traffic-setting', choices=cls._ALL_NET_CONFIGS, |
| 79 default=traffic_setting.REGULAR_4G, | 78 default=traffic_setting.REGULAR_4G, |
| 80 help='Traffic condition (string). Default to "%%default". Can be: %s' % | 79 help='Traffic condition (string). Default to "%%default". Can be: %s' % |
| 81 ', '.join(cls._ALL_NET_CONFIGS)) | 80 ', '.join(cls._ALL_NET_CONFIGS)) |
| 82 | 81 |
| 83 def CreateStorySet(self, options): | 82 def CreateStorySet(self, options): |
| 84 def Wait(action_runner): | 83 def Wait(action_runner): |
| 85 action_runner.Wait(options.wait_time) | 84 action_runner.Wait(options.wait_time) |
| 86 return page_sets.CTPageSet( | 85 return page_sets.CTPageSet( |
| 87 options.urls_list, options.user_agent, options.archive_data_file, | 86 options.urls_list, options.user_agent, options.archive_data_file, |
| 88 traffic_setting=options.traffic_setting, | 87 traffic_setting=options.traffic_setting, |
| 89 run_page_interaction_callback=Wait) | 88 run_page_interaction_callback=Wait) |
| OLD | NEW |