1 # Copyright 2013 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 from telemetry
import benchmark
7 from measurements
import page_cycler
11 class _PageCycler(benchmark
.Benchmark
):
12 options
= {'pageset_repeat': 6}
13 cold_load_percent
= 50 # % of page visits for which a cold load is forced
20 def AddBenchmarkCommandLineArgs(cls
, parser
):
21 parser
.add_option('--report-speed-index',
23 help='Enable the speed index metric.')
26 def ValueCanBeAddedPredicate(cls
, _
, is_first_result
):
27 return cls
.cold_load_percent
> 0 or not is_first_result
29 def CreatePageTest(self
, options
):
30 return page_cycler
.PageCycler(
31 page_repeat
= options
.page_repeat
,
32 pageset_repeat
= options
.pageset_repeat
,
33 cold_load_percent
= self
.cold_load_percent
,
34 report_speed_index
= options
.report_speed_index
)
37 # This is an old page set, we intend to remove it after more modern benchmarks
39 @benchmark.Enabled('chromeos')
40 class PageCyclerDhtml(_PageCycler
):
41 """Benchmarks for various DHTML operations like simple animations."""
42 page_set
= page_sets
.DhtmlPageSet
46 return 'page_cycler.dhtml'
49 class PageCyclerIntlArFaHe(_PageCycler
):
50 """Page load time for a variety of pages in Arabic, Farsi and Hebrew.
52 Runs against pages recorded in April, 2013.
54 page_set
= page_sets
.IntlArFaHePageSet
58 return 'page_cycler.intl_ar_fa_he'
61 @benchmark.Disabled('win') # crbug.com/366715
62 class PageCyclerIntlEsFrPtBr(_PageCycler
):
63 """Page load time for a pages in Spanish, French and Brazilian Portuguese.
65 Runs against pages recorded in April, 2013.
67 page_set
= page_sets
.IntlEsFrPtBrPageSet
71 return 'page_cycler.intl_es_fr_pt-BR'
74 class PageCyclerIntlHiRu(_PageCycler
):
75 """Page load time benchmark for a variety of pages in Hindi and Russian.
77 Runs against pages recorded in April, 2013.
79 page_set
= page_sets
.IntlHiRuPageSet
83 return 'page_cycler.intl_hi_ru'
86 @benchmark.Disabled('android', 'win') # crbug.com/379564, crbug.com/434366
87 class PageCyclerIntlJaZh(_PageCycler
):
88 """Page load time benchmark for a variety of pages in Japanese and Chinese.
90 Runs against pages recorded in April, 2013.
92 page_set
= page_sets
.IntlJaZhPageSet
96 return 'page_cycler.intl_ja_zh'
99 @benchmark.Disabled('xp') # crbug.com/434366
100 class PageCyclerIntlKoThVi(_PageCycler
):
101 """Page load time for a variety of pages in Korean, Thai and Vietnamese.
103 Runs against pages recorded in April, 2013.
105 page_set
= page_sets
.IntlKoThViPageSet
109 return 'page_cycler.intl_ko_th_vi'
112 class PageCyclerMorejs(_PageCycler
):
113 """Page load for a variety of pages that were JavaScript heavy in 2009."""
114 page_set
= page_sets
.MorejsPageSet
118 return 'page_cycler.morejs'
121 # This is an old page set, we intend to remove it after more modern benchmarks
123 @benchmark.Enabled('chromeos')
124 class PageCyclerMoz(_PageCycler
):
125 """Page load for mozilla's original page set. Recorded in December 2000."""
126 page_set
= page_sets
.MozPageSet
130 return 'page_cycler.moz'
133 # Win, mac, linux: crbug.com/353260
134 # Android: crbug.com/473161
135 @benchmark.Disabled('linux', 'win', 'mac', 'android')
136 class PageCyclerNetsimTop10(_PageCycler
):
137 """Measures load time of the top 10 sites under simulated cable network.
139 Recorded in June, 2013. Pages are loaded under the simplisticly simulated
140 bandwidth and RTT constraints of a cable modem (5Mbit/s down, 1Mbit/s up,
141 28ms RTT). Contention is realistically simulated, but slow start is not.
142 DNS lookups are 'free'.
145 page_set
= page_sets
.Top10PageSet
147 'extra_wpr_args_as_string': '--shaping_type=proxy --net=cable',
150 cold_load_percent
= 100
154 return 'page_cycler.netsim.top_10'
156 def CreatePageTest(self
, options
):
157 return page_cycler
.PageCycler(
158 page_repeat
= options
.page_repeat
,
159 pageset_repeat
= options
.pageset_repeat
,
160 cold_load_percent
= self
.cold_load_percent
,
161 report_speed_index
= options
.report_speed_index
,
162 clear_cache_before_each_run
= True)
165 @benchmark.Enabled('android')
166 class PageCyclerTop10Mobile(_PageCycler
):
167 """Page load time benchmark for the top 10 mobile web pages.
169 Runs against pages recorded in November, 2013.
174 return 'page_cycler.top_10_mobile'
176 def CreatePageSet(self
, options
):
177 return page_sets
.Top10MobilePageSet(run_no_page_interactions
=True)
181 class PageCyclerKeyMobileSites(_PageCycler
):
182 """Page load time benchmark for key mobile sites."""
183 page_set
= page_sets
.KeyMobileSitesPageSet
187 return 'page_cycler.key_mobile_sites_smooth'
190 @benchmark.Disabled('android') # crbug.com/357326
191 class PageCyclerToughLayoutCases(_PageCycler
):
192 """Page loading for the slowest layouts observed in the Alexa top 1 million.
194 Recorded in July 2013.
196 page_set
= page_sets
.ToughLayoutCasesPageSet
200 return 'page_cycler.tough_layout_cases'
203 # crbug.com/273986: This test is flakey on Windows.
204 @benchmark.Disabled('win')
205 class PageCyclerTypical25(_PageCycler
):
206 """Page load time benchmark for a 25 typical web pages.
208 Designed to represent typical, not highly optimized or highly popular web
209 sites. Runs against pages recorded in June, 2014.
214 return 'page_cycler.typical_25'
216 def CreatePageSet(self
, options
):
217 return page_sets
.Typical25PageSet(run_no_page_interactions
=True)
219 # crbug.com/273986: This test is flakey on Windows.
220 @benchmark.Disabled
# crbug.com/463346: Test is crashing Chrome.
221 class PageCyclerOopifTypical25(_PageCycler
):
222 """ A varation of the benchmark above, but running in --site-per-process
223 to allow measuring performance of out-of-process iframes.
227 return 'page_cycler_oopif.typical_25'
229 def CustomizeBrowserOptions(self
, options
):
230 options
.AppendExtraBrowserArgs(['--site-per-process'])
232 def CreatePageSet(self
, options
):
233 return page_sets
.Typical25PageSet(run_no_page_interactions
=True)
235 @benchmark.Disabled
# crbug.com/443730
236 class PageCyclerBigJs(_PageCycler
):
237 page_set
= page_sets
.BigJsPageSet
240 return 'page_cycler.big_js'