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 metric_dependencies |
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 @benchmark.Enabled('android') |
17 class LoadingMobile(perf_benchmark.PerfBenchmark): | 17 class LoadingMobile(perf_benchmark.PerfBenchmark): |
18 """ A benchmark measuring loading performance of mobile sites. """ | 18 """ A benchmark measuring loading performance of mobile sites. """ |
19 | 19 |
20 options = {'pageset_repeat': 2} | 20 options = {'pageset_repeat': 2} |
21 | 21 |
22 def CreateTimelineBasedMeasurementOptions(self): | 22 def CreateTimelineBasedMeasurementOptions(self): |
23 tbm_options = timeline_based_measurement.Options() | 23 tbm_options = timeline_based_measurement.Options() |
24 page_cycler_v2.AugmentOptionsForLoadingMetrics(tbm_options) | 24 tbm_options.SetTimelineBasedMetrics(['loadingMetric']) |
| 25 metric_dependencies.AugmentOptionsForMetrics(tbm_options, ['loadingMetric']) |
25 return tbm_options | 26 return tbm_options |
26 | 27 |
27 @classmethod | 28 @classmethod |
28 def ShouldDisable(cls, possible_browser): | 29 def ShouldDisable(cls, possible_browser): |
29 # crbug.com/619254 | 30 # crbug.com/619254 |
30 if possible_browser.browser_type == 'reference': | 31 if possible_browser.browser_type == 'reference': |
31 return True | 32 return True |
32 | 33 |
33 # crbug.com/676612 | 34 # crbug.com/676612 |
34 if ((possible_browser.platform.GetDeviceTypeName() == 'Nexus 6' or | 35 if ((possible_browser.platform.GetDeviceTypeName() == 'Nexus 6' or |
(...skipping 17 matching lines...) Expand all Loading... |
52 # waterfall any time soon. | 53 # waterfall any time soon. |
53 @benchmark.Disabled('all') | 54 @benchmark.Disabled('all') |
54 class LoadingClusterTelemetry(perf_benchmark.PerfBenchmark): | 55 class LoadingClusterTelemetry(perf_benchmark.PerfBenchmark): |
55 | 56 |
56 options = {'upload_results': True} | 57 options = {'upload_results': True} |
57 | 58 |
58 _ALL_NET_CONFIGS = traffic_setting.NETWORK_CONFIGS.keys() | 59 _ALL_NET_CONFIGS = traffic_setting.NETWORK_CONFIGS.keys() |
59 | 60 |
60 def CreateTimelineBasedMeasurementOptions(self): | 61 def CreateTimelineBasedMeasurementOptions(self): |
61 tbm_options = timeline_based_measurement.Options() | 62 tbm_options = timeline_based_measurement.Options() |
62 page_cycler_v2.AugmentOptionsForLoadingMetrics(tbm_options) | 63 tbm_options.SetTimelineBasedMetrics(['loadingMetric']) |
| 64 metric_dependencies.AugmentOptionsForMetrics(tbm_options, ['loadingMetric']) |
63 return tbm_options | 65 return tbm_options |
64 | 66 |
65 @classmethod | 67 @classmethod |
66 def Name(cls): | 68 def Name(cls): |
67 return 'loading.cluster_telemetry' | 69 return 'loading.cluster_telemetry' |
68 | 70 |
69 @classmethod | 71 @classmethod |
70 def AddBenchmarkCommandLineArgs(cls, parser): | 72 def AddBenchmarkCommandLineArgs(cls, parser): |
71 super(LoadingClusterTelemetry, cls).AddBenchmarkCommandLineArgs(parser) | 73 super(LoadingClusterTelemetry, cls).AddBenchmarkCommandLineArgs(parser) |
72 ct_benchmarks_util.AddBenchmarkCommandLineArgs(parser) | 74 ct_benchmarks_util.AddBenchmarkCommandLineArgs(parser) |
73 parser.add_option( | 75 parser.add_option( |
74 '--wait-time', action='store', type='int', | 76 '--wait-time', action='store', type='int', |
75 default=60, help='Number of seconds to wait for after navigation.') | 77 default=60, help='Number of seconds to wait for after navigation.') |
76 parser.add_option( | 78 parser.add_option( |
77 '--traffic-setting', choices=cls._ALL_NET_CONFIGS, | 79 '--traffic-setting', choices=cls._ALL_NET_CONFIGS, |
78 default=traffic_setting.REGULAR_4G, | 80 default=traffic_setting.REGULAR_4G, |
79 help='Traffic condition (string). Default to "%%default". Can be: %s' % | 81 help='Traffic condition (string). Default to "%%default". Can be: %s' % |
80 ', '.join(cls._ALL_NET_CONFIGS)) | 82 ', '.join(cls._ALL_NET_CONFIGS)) |
81 | 83 |
82 def CreateStorySet(self, options): | 84 def CreateStorySet(self, options): |
83 def Wait(action_runner): | 85 def Wait(action_runner): |
84 action_runner.Wait(options.wait_time) | 86 action_runner.Wait(options.wait_time) |
85 return page_sets.CTPageSet( | 87 return page_sets.CTPageSet( |
86 options.urls_list, options.user_agent, options.archive_data_file, | 88 options.urls_list, options.user_agent, options.archive_data_file, |
87 traffic_setting=options.traffic_setting, | 89 traffic_setting=options.traffic_setting, |
88 run_page_interaction_callback=Wait) | 90 run_page_interaction_callback=Wait) |
OLD | NEW |