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.
5 from core
import perf_benchmark
7 from benchmarks
import silk_flags
8 from measurements
import thread_times
10 from telemetry
import benchmark
12 class _ThreadTimes(perf_benchmark
.PerfBenchmark
):
14 def AddBenchmarkCommandLineArgs(cls
, parser
):
15 parser
.add_option('--report-silk-details', action
='store_true',
16 help='Report details relevant to silk.')
23 def ValueCanBeAddedPredicate(cls
, value
, _
):
24 # Default to only reporting per-frame metrics.
25 return 'per_second' not in value
.name
27 def CreatePageTest(self
, options
):
28 return thread_times
.ThreadTimes(options
.report_silk_details
)
31 @benchmark.Enabled('android')
32 class ThreadTimesKeySilkCases(_ThreadTimes
):
33 """Measures timeline metrics while performing smoothness action on key silk
35 page_set
= page_sets
.KeySilkCasesPageSet
39 return 'thread_times.key_silk_cases'
42 @benchmark.Enabled('android', 'linux')
43 class ThreadTimesKeyHitTestCases(_ThreadTimes
):
44 """Measure timeline metrics while performing smoothness action on key hit
46 page_set
= page_sets
.KeyHitTestCasesPageSet
50 return 'thread_times.key_hit_test_cases'
53 @benchmark.Enabled('android')
54 class ThreadTimesFastPathMobileSites(_ThreadTimes
):
55 """Measures timeline metrics while performing smoothness action on
56 key mobile sites labeled with fast-path tag.
57 http://www.chromium.org/developers/design-documents/rendering-benchmarks"""
58 page_set
= page_sets
.KeyMobileSitesSmoothPageSet
59 options
= {'story_label_filter' : 'fastpath'}
63 return 'thread_times.key_mobile_sites_smooth'
66 @benchmark.Enabled('android')
67 class ThreadTimesSimpleMobileSites(_ThreadTimes
):
68 """Measures timeline metric using smoothness action on simple mobile sites
69 http://www.chromium.org/developers/design-documents/rendering-benchmarks"""
70 page_set
= page_sets
.SimpleMobileSitesPageSet
74 return 'thread_times.simple_mobile_sites'
77 @benchmark.Disabled('win') # crbug.com/443781
78 class ThreadTimesCompositorCases(_ThreadTimes
):
79 """Measures timeline metrics while performing smoothness action on
80 tough compositor cases, using software rasterization.
82 http://www.chromium.org/developers/design-documents/rendering-benchmarks"""
83 page_set
= page_sets
.ToughCompositorCasesPageSet
84 def SetExtraBrowserOptions(self
, options
):
85 silk_flags
.CustomizeBrowserOptionsForSoftwareRasterization(options
)
89 return 'thread_times.tough_compositor_cases'
91 @benchmark.Enabled('android')
92 class ThreadTimesPolymer(_ThreadTimes
):
93 """Measures timeline metrics while performing smoothness action on
95 page_set
= page_sets
.PolymerPageSet
98 return 'thread_times.polymer'
101 @benchmark.Enabled('android')
102 class ThreadTimesKeyIdlePowerCases(_ThreadTimes
):
103 """Measures timeline metrics for sites that should be idle in foreground
104 and background scenarios. The metrics are per-second rather than per-frame."""
105 page_set
= page_sets
.KeyIdlePowerCasesPageSet
109 return 'thread_times.key_idle_power_cases'
112 def ValueCanBeAddedPredicate(cls
, value
, _
):
113 # Only report per-second metrics.
114 return 'per_frame' not in value
.name
and 'mean_frame' not in value
.name
117 @benchmark.Enabled('android')
118 class ThreadTimesKeyNoOpCases(_ThreadTimes
):
119 """Measures timeline metrics for common interactions and behaviors that should
120 have minimal cost. The metrics are per-second rather than per-frame."""
121 page_set
= page_sets
.KeyNoOpCasesPageSet
125 return 'thread_times.key_noop_cases'
128 def ValueCanBeAddedPredicate(cls
, value
, _
):
129 # Only report per-second metrics.
130 return 'per_frame' not in value
.name
and 'mean_frame' not in value
.name
133 class ThreadTimesToughScrollingCases(_ThreadTimes
):
134 """Measure timeline metrics while performing smoothness action on tough
136 page_set
= page_sets
.ToughScrollingCasesPageSet
140 return 'thread_times.tough_scrolling_cases'