Mojo C++ bindings: better log message for serialization warnings.
[chromium-blink-merge.git] / tools / perf / page_sets / tough_scheduling_cases.py
blob2cc7ca6f4dff4c7624feb3987dacd72f50bd5efc
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__(url=url, page_set=page_set)
13 def RunSmoothness(self, action_runner):
14 interaction = action_runner.BeginGestureInteraction(
15 'ScrollAction', is_smooth=True)
16 action_runner.ScrollPage()
17 interaction.End()
20 class Page1(ToughSchedulingCasesPage):
22 """ Why: Simulate oversubscribed main thread """
24 def __init__(self, page_set):
25 super(Page1, self).__init__(
26 url='file://tough_scheduling_cases/simple_text_page.html?main_busy',
27 page_set=page_set)
29 self.synthetic_delays = {'cc.BeginMainFrame': {'target_duration': 0.008}}
32 class Page2(ToughSchedulingCasesPage):
34 """ Why: Simulate oversubscribed main thread """
36 def __init__(self, page_set):
37 super(Page2, self).__init__(
38 # pylint: disable=C0301
39 url='file://tough_scheduling_cases/simple_text_page.html?main_very_busy',
40 page_set=page_set)
42 self.synthetic_delays = {'cc.BeginMainFrame': {'target_duration': 0.024}}
45 class Page3(ToughSchedulingCasesPage):
47 """ Why: Simulate a page with a a few graphics layers """
49 def __init__(self, page_set):
50 super(Page3, self).__init__(
51 # pylint: disable=C0301
52 url='file://tough_scheduling_cases/simple_text_page.html?medium_layers',
53 page_set=page_set)
55 self.synthetic_delays = {
56 'cc.DrawAndSwap': {'target_duration': 0.004},
57 'gpu.PresentingFrame': {'target_duration': 0.004},
58 'cc.BeginMainFrame': {'target_duration': 0.004}
62 class Page4(ToughSchedulingCasesPage):
64 """ Why: Simulate a page with many graphics layers """
66 def __init__(self, page_set):
67 super(Page4, self).__init__(
68 # pylint: disable=C0301
69 url='file://tough_scheduling_cases/simple_text_page.html?many_layers',
70 page_set=page_set)
72 self.synthetic_delays = {
73 'cc.DrawAndSwap': {'target_duration': 0.012},
74 'gpu.PresentingFrame': {'target_duration': 0.012},
75 'cc.BeginMainFrame': {'target_duration': 0.012}
79 class Page5(ToughSchedulingCasesPage):
81 """ Why: Simulate a page with expensive recording and rasterization """
83 def __init__(self, page_set):
84 super(Page5, self).__init__(
85 # pylint: disable=C0301
86 url='file://tough_scheduling_cases/simple_text_page.html?medium_raster',
87 page_set=page_set)
89 self.synthetic_delays = {
90 'cc.RasterRequiredForActivation': {'target_duration': 0.004},
91 'cc.BeginMainFrame': {'target_duration': 0.004},
92 'gpu.AsyncTexImage': {'target_duration': 0.004}
96 class Page6(ToughSchedulingCasesPage):
98 """ Why: Simulate a page with expensive recording and rasterization """
100 def __init__(self, page_set):
101 super(Page6, self).__init__(
102 # pylint: disable=C0301
103 url='file://tough_scheduling_cases/simple_text_page.html?heavy_raster',
104 page_set=page_set)
106 self.synthetic_delays = {
107 'cc.RasterRequiredForActivation': {'target_duration': 0.024},
108 'cc.BeginMainFrame': {'target_duration': 0.024},
109 'gpu.AsyncTexImage': {'target_duration': 0.024}
113 class Page7(ToughSchedulingCasesPage):
115 """ Why: Medium cost touch handler """
117 def __init__(self, page_set):
118 super(Page7, self).__init__(
119 # pylint: disable=C0301
120 url='file://tough_scheduling_cases/touch_handler_scrolling.html?medium_handler',
121 page_set=page_set)
123 self.synthetic_delays = {'blink.HandleInputEvent':
124 {'target_duration': 0.008}}
127 class Page8(ToughSchedulingCasesPage):
129 """ Why: Slow touch handler """
131 def __init__(self, page_set):
132 super(Page8, self).__init__(
133 # pylint: disable=C0301
134 url='file://tough_scheduling_cases/touch_handler_scrolling.html?slow_handler',
135 page_set=page_set)
137 self.synthetic_delays = {'blink.HandleInputEvent':
138 {'target_duration': 0.024}}
141 class Page9(ToughSchedulingCasesPage):
143 """ Why: Touch handler that often takes a long time """
145 def __init__(self, page_set):
146 super(Page9, self).__init__(
147 # pylint: disable=C0301
148 url='file://tough_scheduling_cases/touch_handler_scrolling.html?janky_handler',
149 page_set=page_set)
151 self.synthetic_delays = {'blink.HandleInputEvent':
152 {'target_duration': 0.024, 'mode': 'alternating'}
156 class Page10(ToughSchedulingCasesPage):
158 """ Why: Touch handler that occasionally takes a long time """
160 def __init__(self, page_set):
161 super(Page10, self).__init__(
162 # pylint: disable=C0301
163 url='file://tough_scheduling_cases/touch_handler_scrolling.html?occasionally_janky_handler',
164 page_set=page_set)
166 self.synthetic_delays = {'blink.HandleInputEvent':
167 {'target_duration': 0.024, 'mode': 'oneshot'}}
170 class Page11(ToughSchedulingCasesPage):
172 """ Why: Super expensive touch handler causes browser to scroll after a
173 timeout.
176 def __init__(self, page_set):
177 super(Page11, self).__init__(
178 # pylint: disable=C0301
179 url='file://tough_scheduling_cases/touch_handler_scrolling.html?super_slow_handler',
180 page_set=page_set)
182 self.synthetic_delays = {'blink.HandleInputEvent':
183 {'target_duration': 0.2}}
186 class Page12(ToughSchedulingCasesPage):
188 """ Why: Super expensive touch handler that only occupies a part of the page.
191 def __init__(self, page_set):
192 super(Page12, self).__init__(
193 url='file://tough_scheduling_cases/div_touch_handler.html',
194 page_set=page_set)
196 self.synthetic_delays = {'blink.HandleInputEvent': {'target_duration': 0.2}}
199 class Page13(ToughSchedulingCasesPage):
201 """ Why: Test a moderately heavy requestAnimationFrame handler """
203 def __init__(self, page_set):
204 super(Page13, self).__init__(
205 url='file://tough_scheduling_cases/raf.html?medium_handler',
206 page_set=page_set)
208 self.synthetic_delays = {
209 'cc.RasterRequiredForActivation': {'target_duration': 0.004},
210 'cc.BeginMainFrame': {'target_duration': 0.004},
211 'gpu.AsyncTexImage': {'target_duration': 0.004}
215 class Page14(ToughSchedulingCasesPage):
217 """ Why: Test a moderately heavy requestAnimationFrame handler """
219 def __init__(self, page_set):
220 super(Page14, self).__init__(
221 url='file://tough_scheduling_cases/raf.html?heavy_handler',
222 page_set=page_set)
224 self.synthetic_delays = {
225 'cc.RasterRequiredForActivation': {'target_duration': 0.024},
226 'cc.BeginMainFrame': {'target_duration': 0.024},
227 'gpu.AsyncTexImage': {'target_duration': 0.024}
231 class Page15(ToughSchedulingCasesPage):
233 """ Why: Simulate a heavily GPU bound page """
235 def __init__(self, page_set):
236 super(Page15, self).__init__(
237 url='file://tough_scheduling_cases/raf.html?gpu_bound',
238 page_set=page_set)
240 self.synthetic_delays = {'gpu.PresentingFrame': {'target_duration': 0.1}}
243 class Page16(ToughSchedulingCasesPage):
245 """ Why: Test a requestAnimationFrame handler with a heavy first frame """
247 def __init__(self, page_set):
248 super(Page16, self).__init__(
249 url='file://tough_scheduling_cases/raf.html?heavy_first_frame',
250 page_set=page_set)
252 self.synthetic_delays = {'cc.BeginMainFrame': {'target_duration': 0.15}}
255 class Page17(ToughSchedulingCasesPage):
257 """ Why: Medium stress test for the scheduler """
259 def __init__(self, page_set):
260 super(Page17, self).__init__(
261 url='file://tough_scheduling_cases/raf_touch_animation.html?medium',
262 page_set=page_set)
264 self.synthetic_delays = {
265 'cc.DrawAndSwap': {'target_duration': 0.004},
266 'cc.BeginMainFrame': {'target_duration': 0.004}
270 class Page18(ToughSchedulingCasesPage):
272 """ Why: Heavy stress test for the scheduler """
274 def __init__(self, page_set):
275 super(Page18, self).__init__(
276 url='file://tough_scheduling_cases/raf_touch_animation.html?heavy',
277 page_set=page_set)
279 self.synthetic_delays = {
280 'cc.DrawAndSwap': {'target_duration': 0.012},
281 'cc.BeginMainFrame': {'target_duration': 0.012}
285 class Page19(ToughSchedulingCasesPage):
287 """ Why: Both main and impl thread animating concurrently """
289 def __init__(self, page_set):
290 super(Page19, self).__init__(
291 url='file://tough_scheduling_cases/split_animation.html',
292 page_set=page_set)
294 def RunSmoothness(self, action_runner):
295 action_runner.Wait(3)
298 class Page20(ToughSchedulingCasesPage):
300 """ Why: Simple JS touch dragging """
302 def __init__(self, page_set):
303 super(Page20, self).__init__(
304 url='file://tough_scheduling_cases/simple_touch_drag.html',
305 page_set=page_set)
307 def RunSmoothness(self, action_runner):
308 interaction = action_runner.BeginGestureInteraction(
309 'ScrollAction', is_smooth=True)
310 action_runner.ScrollElement(
311 selector='#card',
312 use_touch=True,
313 direction='up',
314 speed_in_pixels_per_second=150,
315 distance=400)
316 interaction.End()
319 class EmptyTouchHandlerPage(ToughSchedulingCasesPage):
321 """ Why: Scrolling on a page with a touch handler that consumes no events but
322 may be slow """
324 def __init__(self, name, desktop, slow_handler, bounce, page_set):
325 super(EmptyTouchHandlerPage, self).__init__(
326 url='file://tough_scheduling_cases/empty_touch_handler' +
327 ('_desktop' if desktop else '') + '.html?' + name,
328 page_set=page_set)
330 if slow_handler:
331 self.synthetic_delays = {
332 'blink.HandleInputEvent': {'target_duration': 0.2}
335 self.bounce = bounce
337 def RunSmoothness(self, action_runner):
338 if self.bounce:
339 interaction = action_runner.BeginGestureInteraction(
340 'ScrollBounceAction', is_smooth=True)
341 action_runner.ScrollBouncePage()
342 interaction.End()
343 else:
344 interaction = action_runner.BeginGestureInteraction(
345 'ScrollAction', is_smooth=True)
346 # Speed and distance are tuned to run exactly as long as a scroll
347 # bounce.
348 action_runner.ScrollPage(use_touch=True, speed_in_pixels_per_second=400,
349 distance=2100)
350 interaction.End()
353 class SynchronizedScrollOffsetPage(ToughSchedulingCasesPage):
355 """Why: For measuring the latency of scroll-synchronized effects."""
357 def __init__(self, page_set):
358 super(SynchronizedScrollOffsetPage, self).__init__(
359 url='file://tough_scheduling_cases/sync_scroll_offset.html',
360 page_set=page_set)
362 def RunSmoothness(self, action_runner):
363 interaction = action_runner.BeginGestureInteraction(
364 'ScrollBounceAction', is_smooth=True)
365 action_runner.ScrollBouncePage()
366 interaction.End()
369 class ToughSchedulingCasesPageSet(page_set_module.PageSet):
371 """ Tough scheduler latency test cases """
373 def __init__(self):
374 super(ToughSchedulingCasesPageSet, self).__init__()
376 # Why: Simple scrolling baseline
377 self.AddPage(ToughSchedulingCasesPage(
378 'file://tough_scheduling_cases/simple_text_page.html',
379 self))
380 self.AddPage(Page1(self))
381 self.AddPage(Page2(self))
382 self.AddPage(Page3(self))
383 self.AddPage(Page4(self))
384 self.AddPage(Page5(self))
385 # self.AddPage(Page6(self)) Flaky crbug.com/368532
386 # Why: Touch handler scrolling baseline
387 self.AddPage(ToughSchedulingCasesPage(
388 'file://tough_scheduling_cases/touch_handler_scrolling.html',
389 self))
390 self.AddPage(Page7(self))
391 self.AddPage(Page8(self))
392 self.AddPage(Page9(self))
393 self.AddPage(Page10(self))
394 self.AddPage(Page11(self))
395 self.AddPage(Page12(self))
396 # Why: requestAnimationFrame scrolling baseline
397 self.AddPage(ToughSchedulingCasesPage(
398 'file://tough_scheduling_cases/raf.html',
399 self))
400 # Why: Test canvas blocking behavior
401 self.AddPage(ToughSchedulingCasesPage(
402 'file://tough_scheduling_cases/raf_canvas.html',
403 self))
404 self.AddPage(Page13(self))
405 # Disabled for flakiness. See 368532
406 # self.AddPage(Page14(self))
407 self.AddPage(Page15(self))
408 self.AddPage(Page16(self))
409 # Why: Test a requestAnimationFrame handler with concurrent CSS animation
410 self.AddPage(ToughSchedulingCasesPage(
411 'file://tough_scheduling_cases/raf_animation.html',
412 self))
413 # Why: Stress test for the scheduler
414 self.AddPage(ToughSchedulingCasesPage(
415 'file://tough_scheduling_cases/raf_touch_animation.html',
416 self))
417 self.AddPage(Page17(self))
418 self.AddPage(Page18(self))
419 self.AddPage(Page19(self))
420 self.AddPage(Page20(self))
421 # Why: Baseline for scrolling in the presence of a no-op touch handler
422 self.AddPage(EmptyTouchHandlerPage(
423 name='baseline',
424 desktop=False,
425 slow_handler=False,
426 bounce=False,
427 page_set=self))
428 # Why: Slow handler blocks scroll start
429 self.AddPage(EmptyTouchHandlerPage(
430 name='slow_handler',
431 desktop=False,
432 slow_handler=True,
433 bounce=False,
434 page_set=self))
435 # Why: Slow handler blocks scroll start until touch ACK timeout
436 self.AddPage(EmptyTouchHandlerPage(
437 name='desktop_slow_handler',
438 desktop=True,
439 slow_handler=True,
440 bounce=False,
441 page_set=self))
442 # Why: Scroll bounce showing repeated transitions between scrolling and
443 # sending synchronous touchmove events. Should be nearly as fast as
444 # scroll baseline.
445 self.AddPage(EmptyTouchHandlerPage(
446 name='bounce',
447 desktop=False,
448 slow_handler=False,
449 bounce=True,
450 page_set=self))
451 # Why: Scroll bounce with slow handler, repeated blocking.
452 self.AddPage(EmptyTouchHandlerPage(
453 name='bounce_slow_handler',
454 desktop=False,
455 slow_handler=True,
456 bounce=True,
457 page_set=self))
458 # Why: Scroll bounce with slow handler on desktop, blocks only once until
459 # ACK timeout.
460 self.AddPage(EmptyTouchHandlerPage(
461 name='bounce_desktop_slow_handler',
462 desktop=True,
463 slow_handler=True,
464 bounce=True,
465 page_set=self))
466 # Why: For measuring the latency of scroll-synchronized effects.
467 self.AddPage(SynchronizedScrollOffsetPage(page_set=self))