Chromium Code Reviews| 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 class _LoadingBase(perf_benchmark.PerfBenchmark): | 16 class _LoadingBase(perf_benchmark.PerfBenchmark): |
| 17 """ A base class for loading benchmarks. """ | 17 """ A base class for loading benchmarks. """ |
| 18 | 18 |
| 19 options = {'pageset_repeat': 2} | 19 options = {'pageset_repeat': 2} |
| 20 SUBNAME = None | |
| 20 | 21 |
| 21 def CreateTimelineBasedMeasurementOptions(self): | 22 def CreateTimelineBasedMeasurementOptions(self): |
| 22 tbm_options = timeline_based_measurement.Options() | 23 tbm_options = timeline_based_measurement.Options() |
| 23 page_cycler_v2.AugmentOptionsForLoadingMetrics(tbm_options) | 24 page_cycler_v2.AugmentOptionsForLoadingMetrics(tbm_options) |
| 24 return tbm_options | 25 return tbm_options |
| 25 | 26 |
| 27 @classmethod | |
| 28 def Name(cls): | |
| 29 assert cls.SUBNAME | |
| 30 return 'loading.%s' % cls.SUBNAME | |
|
nednguyen
2017/04/26 21:02:36
its' better just uses the raw strings so people ca
rnephew (Reviews Here)
2017/04/26 21:15:43
Acknowledged.
| |
| 31 | |
| 32 | |
| 33 @benchmark.Disabled('android') | |
| 34 @benchmark.Owner(emails=['kouhei@chormium.org', 'ksakamoto@chromium.org']) | |
| 35 class LoadingDesktop(_LoadingBase): | |
| 36 """ A benchmark measuring loading performance of desktop sites. """ | |
| 37 SUBNAME = 'desktop' | |
| 38 | |
| 39 @classmethod | |
| 40 def ShouldDisable(cls, possible_browser): | |
| 41 return possible_browser.browser_type == 'reference' | |
| 42 | |
| 43 def CreateStorySet(self, options): | |
| 44 return page_sets.LoadingDesktopStorySet( | |
| 45 cache_temperatures=[cache_temperature.ANY]) | |
|
nednguyen
2017/04/26 21:02:36
I think we would need cold & warm cache
rnephew (Reviews Here)
2017/04/26 21:15:43
The existing loading.mobile benchmark uses the sam
nednguyen
2017/05/01 19:50:47
Not sure, but for now, we need to make sure that t
| |
| 46 | |
| 26 | 47 |
| 27 @benchmark.Enabled('android') | 48 @benchmark.Enabled('android') |
| 28 @benchmark.Owner(emails=['kouhei@chromium.org', 'ksakamoto@chromium.org']) | 49 @benchmark.Owner(emails=['kouhei@chromium.org', 'ksakamoto@chromium.org']) |
| 29 class LoadingMobile(_LoadingBase): | 50 class LoadingMobile(_LoadingBase): |
| 30 """ A benchmark measuring loading performance of mobile sites. """ | 51 """ A benchmark measuring loading performance of mobile sites. """ |
| 52 SUBNAME = 'mobile' | |
| 31 | 53 |
| 32 @classmethod | 54 @classmethod |
| 33 def ShouldDisable(cls, possible_browser): | 55 def ShouldDisable(cls, possible_browser): |
| 34 # crbug.com/619254 | 56 # crbug.com/619254 |
| 35 if possible_browser.browser_type == 'reference': | 57 if possible_browser.browser_type == 'reference': |
| 36 return True | 58 return True |
| 37 | 59 |
| 38 # crbug.com/676612 | 60 # crbug.com/676612 |
| 39 if ((possible_browser.platform.GetDeviceTypeName() == 'Nexus 6' or | 61 if ((possible_browser.platform.GetDeviceTypeName() == 'Nexus 6' or |
| 40 possible_browser.platform.GetDeviceTypeName() == 'AOSP on Shamu') and | 62 possible_browser.platform.GetDeviceTypeName() == 'AOSP on Shamu') and |
| 41 possible_browser.browser_type == 'android-webview'): | 63 possible_browser.browser_type == 'android-webview'): |
| 42 return True | 64 return True |
| 43 | 65 |
| 44 return False | 66 return False |
| 45 | 67 |
| 46 @classmethod | |
| 47 def Name(cls): | |
| 48 return 'loading.mobile' | |
| 49 | |
| 50 def CreateStorySet(self, options): | 68 def CreateStorySet(self, options): |
| 51 return page_sets.LoadingMobileStorySet( | 69 return page_sets.LoadingMobileStorySet( |
| 52 cache_temperatures=[cache_temperature.ANY], | 70 cache_temperatures=[cache_temperature.ANY], |
| 53 traffic_settings=[traffic_setting.NONE, traffic_setting.REGULAR_3G]) | 71 traffic_settings=[traffic_setting.NONE, traffic_setting.REGULAR_3G]) |
| 54 | 72 |
| 55 | 73 |
| 56 # Disabled because we do not plan on running CT benchmarks on the perf | 74 # Disabled because we do not plan on running CT benchmarks on the perf |
| 57 # waterfall any time soon. | 75 # waterfall any time soon. |
| 58 @benchmark.Disabled('all') | 76 @benchmark.Disabled('all') |
| 59 class LoadingClusterTelemetry(_LoadingBase): | 77 class LoadingClusterTelemetry(_LoadingBase): |
| 60 | 78 |
| 61 options = {'upload_results': True} | 79 options = {'upload_results': True} |
| 62 | 80 |
| 63 _ALL_NET_CONFIGS = traffic_setting.NETWORK_CONFIGS.keys() | 81 _ALL_NET_CONFIGS = traffic_setting.NETWORK_CONFIGS.keys() |
| 64 | 82 |
| 65 @classmethod | 83 SUBNAME = 'cluster_telemetry' |
| 66 def Name(cls): | 84 |
| 67 return 'loading.cluster_telemetry' | |
| 68 | 85 |
| 69 @classmethod | 86 @classmethod |
| 70 def AddBenchmarkCommandLineArgs(cls, parser): | 87 def AddBenchmarkCommandLineArgs(cls, parser): |
| 71 super(LoadingClusterTelemetry, cls).AddBenchmarkCommandLineArgs(parser) | 88 super(LoadingClusterTelemetry, cls).AddBenchmarkCommandLineArgs(parser) |
| 72 ct_benchmarks_util.AddBenchmarkCommandLineArgs(parser) | 89 ct_benchmarks_util.AddBenchmarkCommandLineArgs(parser) |
| 73 parser.add_option( | 90 parser.add_option( |
| 74 '--wait-time', action='store', type='int', | 91 '--wait-time', action='store', type='int', |
| 75 default=60, help='Number of seconds to wait for after navigation.') | 92 default=60, help='Number of seconds to wait for after navigation.') |
| 76 parser.add_option( | 93 parser.add_option( |
| 77 '--traffic-setting', choices=cls._ALL_NET_CONFIGS, | 94 '--traffic-setting', choices=cls._ALL_NET_CONFIGS, |
| 78 default=traffic_setting.REGULAR_4G, | 95 default=traffic_setting.REGULAR_4G, |
| 79 help='Traffic condition (string). Default to "%%default". Can be: %s' % | 96 help='Traffic condition (string). Default to "%%default". Can be: %s' % |
| 80 ', '.join(cls._ALL_NET_CONFIGS)) | 97 ', '.join(cls._ALL_NET_CONFIGS)) |
| 81 | 98 |
| 82 def CreateStorySet(self, options): | 99 def CreateStorySet(self, options): |
| 83 def Wait(action_runner): | 100 def Wait(action_runner): |
| 84 action_runner.Wait(options.wait_time) | 101 action_runner.Wait(options.wait_time) |
| 85 return page_sets.CTPageSet( | 102 return page_sets.CTPageSet( |
| 86 options.urls_list, options.user_agent, options.archive_data_file, | 103 options.urls_list, options.user_agent, options.archive_data_file, |
| 87 traffic_setting=options.traffic_setting, | 104 traffic_setting=options.traffic_setting, |
| 88 run_page_interaction_callback=Wait) | 105 run_page_interaction_callback=Wait) |
| OLD | NEW |