Change next_proto member type.
[chromium-blink-merge.git] / tools / perf / page_sets / tough_scheduling_cases.py
blob4f83caf8bce939d5dfd9a1ae50d9611aa086bad0
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
3 # found in the LICENSE file.
4 from telemetry.page import page as page_module
5 from telemetry.page import page_set as page_set_module
8 class ToughSchedulingCasesPage(page_module.Page):
10 def __init__(self, url, page_set):
11 super(ToughSchedulingCasesPage, self).__init__(
12 url=url, page_set=page_set, credentials_path='data/credentials.json')
13 self.user_agent_type = 'mobile'
14 self.archive_data_file = 'data/tough_scheduling_cases.json'
16 def RunSmoothness(self, action_runner):
17 interaction = action_runner.BeginGestureInteraction(
18 'ScrollAction', is_smooth=True)
19 action_runner.ScrollPage()
20 interaction.End()
23 class Page1(ToughSchedulingCasesPage):
25 """ Why: Simulate oversubscribed main thread """
27 def __init__(self, page_set):
28 super(Page1, self).__init__(
29 url='file://tough_scheduling_cases/simple_text_page.html?main_busy',
30 page_set=page_set)
32 self.synthetic_delays = {'cc.BeginMainFrame': {'target_duration': 0.008}}
35 class Page2(ToughSchedulingCasesPage):
37 """ Why: Simulate oversubscribed main thread """
39 def __init__(self, page_set):
40 super(Page2, self).__init__(
41 # pylint: disable=C0301
42 url='file://tough_scheduling_cases/simple_text_page.html?main_very_busy',
43 page_set=page_set)
45 self.synthetic_delays = {'cc.BeginMainFrame': {'target_duration': 0.024}}
48 class Page3(ToughSchedulingCasesPage):
50 """ Why: Simulate a page with a a few graphics layers """
52 def __init__(self, page_set):
53 super(Page3, self).__init__(
54 # pylint: disable=C0301
55 url='file://tough_scheduling_cases/simple_text_page.html?medium_layers',
56 page_set=page_set)
58 self.synthetic_delays = {
59 'cc.DrawAndSwap': {'target_duration': 0.004},
60 'gpu.PresentingFrame': {'target_duration': 0.004},
61 'cc.BeginMainFrame': {'target_duration': 0.004}
65 class Page4(ToughSchedulingCasesPage):
67 """ Why: Simulate a page with many graphics layers """
69 def __init__(self, page_set):
70 super(Page4, self).__init__(
71 # pylint: disable=C0301
72 url='file://tough_scheduling_cases/simple_text_page.html?many_layers',
73 page_set=page_set)
75 self.synthetic_delays = {
76 'cc.DrawAndSwap': {'target_duration': 0.012},
77 'gpu.PresentingFrame': {'target_duration': 0.012},
78 'cc.BeginMainFrame': {'target_duration': 0.012}
82 class Page5(ToughSchedulingCasesPage):
84 """ Why: Simulate a page with expensive recording and rasterization """
86 def __init__(self, page_set):
87 super(Page5, self).__init__(
88 # pylint: disable=C0301
89 url='file://tough_scheduling_cases/simple_text_page.html?medium_raster',
90 page_set=page_set)
92 self.synthetic_delays = {
93 'cc.RasterRequiredForActivation': {'target_duration': 0.004},
94 'cc.BeginMainFrame': {'target_duration': 0.004},
95 'gpu.AsyncTexImage': {'target_duration': 0.004}
99 class Page6(ToughSchedulingCasesPage):
101 """ Why: Simulate a page with expensive recording and rasterization """
103 def __init__(self, page_set):
104 super(Page6, self).__init__(
105 # pylint: disable=C0301
106 url='file://tough_scheduling_cases/simple_text_page.html?heavy_raster',
107 page_set=page_set)
109 self.synthetic_delays = {
110 'cc.RasterRequiredForActivation': {'target_duration': 0.024},
111 'cc.BeginMainFrame': {'target_duration': 0.024},
112 'gpu.AsyncTexImage': {'target_duration': 0.024}
116 class Page7(ToughSchedulingCasesPage):
118 """ Why: Medium cost touch handler """
120 def __init__(self, page_set):
121 super(Page7, self).__init__(
122 # pylint: disable=C0301
123 url='file://tough_scheduling_cases/touch_handler_scrolling.html?medium_handler',
124 page_set=page_set)
126 self.synthetic_delays = {'blink.HandleInputEvent':
127 {'target_duration': 0.008}}
130 class Page8(ToughSchedulingCasesPage):
132 """ Why: Slow touch handler """
134 def __init__(self, page_set):
135 super(Page8, self).__init__(
136 # pylint: disable=C0301
137 url='file://tough_scheduling_cases/touch_handler_scrolling.html?slow_handler',
138 page_set=page_set)
140 self.synthetic_delays = {'blink.HandleInputEvent':
141 {'target_duration': 0.024}}
144 class Page9(ToughSchedulingCasesPage):
146 """ Why: Touch handler that often takes a long time """
148 def __init__(self, page_set):
149 super(Page9, self).__init__(
150 # pylint: disable=C0301
151 url='file://tough_scheduling_cases/touch_handler_scrolling.html?janky_handler',
152 page_set=page_set)
154 self.synthetic_delays = {'blink.HandleInputEvent':
155 {'target_duration': 0.024, 'mode': 'alternating'}
159 class Page10(ToughSchedulingCasesPage):
161 """ Why: Touch handler that occasionally takes a long time """
163 def __init__(self, page_set):
164 super(Page10, self).__init__(
165 # pylint: disable=C0301
166 url='file://tough_scheduling_cases/touch_handler_scrolling.html?occasionally_janky_handler',
167 page_set=page_set)
169 self.synthetic_delays = {'blink.HandleInputEvent':
170 {'target_duration': 0.024, 'mode': 'oneshot'}}
173 class Page11(ToughSchedulingCasesPage):
175 """ Why: Super expensive touch handler causes browser to scroll after a
176 timeout.
179 def __init__(self, page_set):
180 super(Page11, self).__init__(
181 # pylint: disable=C0301
182 url='file://tough_scheduling_cases/touch_handler_scrolling.html?super_slow_handler',
183 page_set=page_set)
185 self.synthetic_delays = {'blink.HandleInputEvent':
186 {'target_duration': 0.2}}
189 class Page12(ToughSchedulingCasesPage):
191 """ Why: Super expensive touch handler that only occupies a part of the page.
194 def __init__(self, page_set):
195 super(Page12, self).__init__(
196 url='file://tough_scheduling_cases/div_touch_handler.html',
197 page_set=page_set)
199 self.synthetic_delays = {'blink.HandleInputEvent': {'target_duration': 0.2}}
202 class Page13(ToughSchedulingCasesPage):
204 """ Why: Test a moderately heavy requestAnimationFrame handler """
206 def __init__(self, page_set):
207 super(Page13, self).__init__(
208 url='file://tough_scheduling_cases/raf.html?medium_handler',
209 page_set=page_set)
211 self.synthetic_delays = {
212 'cc.RasterRequiredForActivation': {'target_duration': 0.004},
213 'cc.BeginMainFrame': {'target_duration': 0.004},
214 'gpu.AsyncTexImage': {'target_duration': 0.004}
218 class Page14(ToughSchedulingCasesPage):
220 """ Why: Test a moderately heavy requestAnimationFrame handler """
222 def __init__(self, page_set):
223 super(Page14, self).__init__(
224 url='file://tough_scheduling_cases/raf.html?heavy_handler',
225 page_set=page_set)
227 self.synthetic_delays = {
228 'cc.RasterRequiredForActivation': {'target_duration': 0.024},
229 'cc.BeginMainFrame': {'target_duration': 0.024},
230 'gpu.AsyncTexImage': {'target_duration': 0.024}
234 class Page15(ToughSchedulingCasesPage):
236 """ Why: Simulate a heavily GPU bound page """
238 def __init__(self, page_set):
239 super(Page15, self).__init__(
240 url='file://tough_scheduling_cases/raf.html?gpu_bound',
241 page_set=page_set)
243 self.synthetic_delays = {'gpu.PresentingFrame': {'target_duration': 0.1}}
246 class Page16(ToughSchedulingCasesPage):
248 """ Why: Test a requestAnimationFrame handler with a heavy first frame """
250 def __init__(self, page_set):
251 super(Page16, self).__init__(
252 url='file://tough_scheduling_cases/raf.html?heavy_first_frame',
253 page_set=page_set)
255 self.synthetic_delays = {'cc.BeginMainFrame': {'target_duration': 0.15,
256 'mode': 'oneshot'}}
259 class Page17(ToughSchedulingCasesPage):
261 """ Why: Medium stress test for the scheduler """
263 def __init__(self, page_set):
264 super(Page17, self).__init__(
265 url='file://tough_scheduling_cases/raf_touch_animation.html?medium',
266 page_set=page_set)
268 self.synthetic_delays = {
269 'cc.DrawAndSwap': {'target_duration': 0.004},
270 'cc.BeginMainFrame': {'target_duration': 0.004}
274 class Page18(ToughSchedulingCasesPage):
276 """ Why: Heavy stress test for the scheduler """
278 def __init__(self, page_set):
279 super(Page18, self).__init__(
280 url='file://tough_scheduling_cases/raf_touch_animation.html?heavy',
281 page_set=page_set)
283 self.synthetic_delays = {
284 'cc.DrawAndSwap': {'target_duration': 0.012},
285 'cc.BeginMainFrame': {'target_duration': 0.012}
289 class Page19(ToughSchedulingCasesPage):
291 """ Why: Both main and impl thread animating concurrently """
293 def __init__(self, page_set):
294 super(Page19, self).__init__(
295 url='file://tough_scheduling_cases/split_animation.html',
296 page_set=page_set)
298 def RunSmoothness(self, action_runner):
299 action_runner.Wait(3)
302 class Page20(ToughSchedulingCasesPage):
304 """ Why: Simple JS touch dragging """
306 def __init__(self, page_set):
307 super(Page20, self).__init__(
308 url='file://tough_scheduling_cases/simple_touch_drag.html',
309 page_set=page_set)
311 def RunSmoothness(self, action_runner):
312 interaction = action_runner.BeginGestureInteraction(
313 'ScrollAction', is_smooth=True)
314 action_runner.ScrollElement(
315 selector='#card',
316 use_touch=True,
317 direction='up',
318 speed_in_pixels_per_second=150,
319 distance=400)
320 interaction.End()
323 class EmptyTouchHandlerPage(ToughSchedulingCasesPage):
325 """ Why: Scrolling on a page with a touch handler that consumes no events but
326 may be slow """
328 def __init__(self, name, desktop, slow_handler, bounce, page_set):
329 super(EmptyTouchHandlerPage, self).__init__(
330 url='file://tough_scheduling_cases/empty_touch_handler' +
331 ('_desktop' if desktop else '') + '.html?' + name,
332 page_set=page_set)
334 if slow_handler:
335 self.synthetic_delays = {
336 'blink.HandleInputEvent': {'target_duration': 0.2}
339 self.bounce = bounce
341 def RunSmoothness(self, action_runner):
342 if self.bounce:
343 interaction = action_runner.BeginGestureInteraction(
344 'ScrollBounceAction', is_smooth=True)
345 action_runner.ScrollBouncePage()
346 interaction.End()
347 else:
348 interaction = action_runner.BeginGestureInteraction(
349 'ScrollAction', is_smooth=True)
350 # Speed and distance are tuned to run exactly as long as a scroll
351 # bounce.
352 action_runner.ScrollPage(use_touch=True, speed_in_pixels_per_second=400,
353 distance=2100)
354 interaction.End()
357 class SynchronizedScrollOffsetPage(ToughSchedulingCasesPage):
359 """Why: For measuring the latency of scroll-synchronized effects."""
361 def __init__(self, page_set):
362 super(SynchronizedScrollOffsetPage, self).__init__(
363 url='file://tough_scheduling_cases/sync_scroll_offset.html',
364 page_set=page_set)
366 def RunSmoothness(self, action_runner):
367 interaction = action_runner.BeginGestureInteraction(
368 'ScrollBounceAction', is_smooth=True)
369 action_runner.ScrollBouncePage()
370 interaction.End()
373 class ToughSchedulingCasesPageSet(page_set_module.PageSet):
375 """ Tough scheduler latency test cases """
377 def __init__(self):
378 super(ToughSchedulingCasesPageSet, self).__init__(
379 user_agent_type='mobile',
380 archive_data_file='data/tough_scheduling_cases.json',
381 bucket=page_set_module.INTERNAL_BUCKET)
383 # Why: Simple scrolling baseline
384 self.AddPage(ToughSchedulingCasesPage(
385 'file://tough_scheduling_cases/simple_text_page.html',
386 self))
387 self.AddPage(Page1(self))
388 self.AddPage(Page2(self))
389 self.AddPage(Page3(self))
390 self.AddPage(Page4(self))
391 # Disabled until crbug.com/413829 is fixed.
392 # self.AddPage(Page5(self))
393 # Disabled because of crbug.com/413829 and flakiness crbug.com/368532
394 # self.AddPage(Page6(self))
395 # Why: Touch handler scrolling baseline
396 self.AddPage(ToughSchedulingCasesPage(
397 'file://tough_scheduling_cases/touch_handler_scrolling.html',
398 self))
399 self.AddPage(Page7(self))
400 self.AddPage(Page8(self))
401 self.AddPage(Page9(self))
402 self.AddPage(Page10(self))
403 self.AddPage(Page11(self))
404 self.AddPage(Page12(self))
405 # Why: requestAnimationFrame scrolling baseline
406 self.AddPage(ToughSchedulingCasesPage(
407 'file://tough_scheduling_cases/raf.html',
408 self))
409 # Why: Test canvas blocking behavior
410 self.AddPage(ToughSchedulingCasesPage(
411 'file://tough_scheduling_cases/raf_canvas.html',
412 self))
413 # Disabled until crbug.com/413829 is fixed.
414 # self.AddPage(Page13(self))
415 # Disabled because of crbug.com/413829 and flakiness crbug.com/368532
416 # self.AddPage(Page14(self))
417 self.AddPage(Page15(self))
418 self.AddPage(Page16(self))
419 # Why: Test a requestAnimationFrame handler with concurrent CSS animation
420 self.AddPage(ToughSchedulingCasesPage(
421 'file://tough_scheduling_cases/raf_animation.html',
422 self))
423 # Why: Stress test for the scheduler
424 self.AddPage(ToughSchedulingCasesPage(
425 'file://tough_scheduling_cases/raf_touch_animation.html',
426 self))
427 self.AddPage(Page17(self))
428 self.AddPage(Page18(self))
429 self.AddPage(Page19(self))
430 self.AddPage(Page20(self))
431 # Why: Baseline for scrolling in the presence of a no-op touch handler
432 self.AddPage(EmptyTouchHandlerPage(
433 name='baseline',
434 desktop=False,
435 slow_handler=False,
436 bounce=False,
437 page_set=self))
438 # Why: Slow handler blocks scroll start
439 self.AddPage(EmptyTouchHandlerPage(
440 name='slow_handler',
441 desktop=False,
442 slow_handler=True,
443 bounce=False,
444 page_set=self))
445 # Why: Slow handler blocks scroll start until touch ACK timeout
446 self.AddPage(EmptyTouchHandlerPage(
447 name='desktop_slow_handler',
448 desktop=True,
449 slow_handler=True,
450 bounce=False,
451 page_set=self))
452 # Why: Scroll bounce showing repeated transitions between scrolling and
453 # sending synchronous touchmove events. Should be nearly as fast as
454 # scroll baseline.
455 self.AddPage(EmptyTouchHandlerPage(
456 name='bounce',
457 desktop=False,
458 slow_handler=False,
459 bounce=True,
460 page_set=self))
461 # Why: Scroll bounce with slow handler, repeated blocking.
462 self.AddPage(EmptyTouchHandlerPage(
463 name='bounce_slow_handler',
464 desktop=False,
465 slow_handler=True,
466 bounce=True,
467 page_set=self))
468 # Why: Scroll bounce with slow handler on desktop, blocks only once until
469 # ACK timeout.
470 self.AddPage(EmptyTouchHandlerPage(
471 name='bounce_desktop_slow_handler',
472 desktop=True,
473 slow_handler=True,
474 bounce=True,
475 page_set=self))
476 # Why: For measuring the latency of scroll-synchronized effects.
477 self.AddPage(SynchronizedScrollOffsetPage(page_set=self))
478 # Why: Good examples of poor initial scrolling
479 self.AddPage(ToughSchedulingCasesPage(
480 'http://www.latimes.com',
481 self))
482 self.AddPage(ToughSchedulingCasesPage(
483 'http://m.espn.go.com/nhl/rankings',
484 self))