1 # Copyright 2015 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
9 from telemetry
import benchmark
10 from telemetry
.timeline
import tracing_category_filter
11 from telemetry
.web_perf
.metrics
import gpu_timeline
12 from telemetry
.web_perf
import timeline_based_measurement
16 TOPLEVEL_CATEGORIES
= ['disabled-by-default-gpu.device',
17 'disabled-by-default-gpu.service']
20 class _GPUTimes(perf_benchmark
.PerfBenchmark
):
21 def CreateTimelineBasedMeasurementOptions(self
):
22 cat_string
= ','.join(TOPLEVEL_CATEGORIES
)
23 cat_filter
= tracing_category_filter
.TracingCategoryFilter(cat_string
)
25 return timeline_based_measurement
.Options(
26 overhead_level
=cat_filter
)
29 def ValueCanBeAddedPredicate(cls
, value
, _
):
30 return (isinstance(value
, gpu_timeline
.GPUTimelineListOfValues
) or
31 isinstance(value
, gpu_timeline
.GPUTimelineValue
))
33 @benchmark.Enabled('android') # http://crbug.com/453131
34 class GPUTimesKeyMobileSites(_GPUTimes
):
35 """Measures GPU timeline metric on key mobile sites."""
36 page_set
= page_sets
.KeyMobileSitesSmoothPageSet
40 return 'gpu_times.key_mobile_sites_smooth'
42 @benchmark.Enabled('android') # http://crbug.com/453131
43 class GPUTimesGpuRasterizationKeyMobileSites(_GPUTimes
):
44 """Measures GPU timeline metric on key mobile sites with GPU rasterization.
46 page_set
= page_sets
.KeyMobileSitesSmoothPageSet
47 def SetExtraBrowserOptions(self
, options
):
48 silk_flags
.CustomizeBrowserOptionsForGpuRasterization(options
)
52 return 'gpu_times.gpu_rasterization.key_mobile_sites_smooth'
54 @benchmark.Enabled('android') # http://crbug.com/453131
55 class GPUTimesTop25Sites(_GPUTimes
):
56 """Measures GPU timeline metric for the top 25 sites."""
57 page_set
= page_sets
.Top25SmoothPageSet
61 return 'gpu_times.top_25_smooth'
63 @benchmark.Enabled('android') # http://crbug.com/453131
64 class GPUTimesGpuRasterizationTop25Sites(_GPUTimes
):
65 """Measures GPU timeline metric for the top 25 sites with GPU rasterization.
67 page_set
= page_sets
.Top25SmoothPageSet
68 def SetExtraBrowserOptions(self
, options
):
69 silk_flags
.CustomizeBrowserOptionsForGpuRasterization(options
)
73 return 'gpu_times.gpu_rasterization.top_25_smooth'