Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Side by Side Diff: tools/perf/measurements/draw_properties.py

Issue 2266223002: cc: Compute draw transforms dynamically. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nit Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright 2015 The Chromium Authors. All rights reserved. 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 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
ajuma 2016/10/12 20:08:48 Do these changes need to land with this patch?
sunxd 2016/10/12 21:08:19 No, I'll have a final run and remove this change.
4 4
5 from telemetry.page import legacy_page_test 5 from telemetry.page import legacy_page_test
6 from telemetry.timeline import model 6 from telemetry.timeline import model
7 from telemetry.timeline import tracing_config 7 from telemetry.timeline import tracing_config
8 from telemetry.value import scalar 8 from telemetry.value import scalar
9 9
10 10
11 class DrawProperties(legacy_page_test.LegacyPageTest): 11 class DrawProperties(legacy_page_test.LegacyPageTest):
12 12
13 def __init__(self): 13 def __init__(self):
14 super(DrawProperties, self).__init__() 14 super(DrawProperties, self).__init__()
15 15
16 def CustomizeBrowserOptions(self, options): 16 def CustomizeBrowserOptions(self, options):
17 options.AppendExtraBrowserArgs([ 17 options.AppendExtraBrowserArgs([
18 '--enable-prefer-compositing-to-lcd-text', 18 '--enable-prefer-compositing-to-lcd-text',
19 ]) 19 ])
20 20
21 def WillNavigateToPage(self, page, tab): 21 def WillNavigateToPage(self, page, tab):
22 del page # unused 22 del page # unused
23 config = tracing_config.TracingConfig() 23 config = tracing_config.TracingConfig()
24 config.chrome_trace_config.category_filter.AddDisabledByDefault( 24 config.chrome_trace_config.category_filter.AddIncludedCategory('cc')
25 'disabled-by-default-cc.debug.cdp-perf')
26 config.enable_chrome_trace = True 25 config.enable_chrome_trace = True
27 tab.browser.platform.tracing_controller.StartTracing(config) 26 tab.browser.platform.tracing_controller.StartTracing(config)
28 27
28 def ComputeTotalDurations(self, timeline_model, name):
29 events = timeline_model.GetAllEventsOfName(name)
30 event_durations = [d.duration for d in events]
31 assert event_durations, 'Failed to find durations'
32
33 duration_sum = sum(event_durations)
34 return duration_sum
35
29 def ComputeAverageOfDurations(self, timeline_model, name): 36 def ComputeAverageOfDurations(self, timeline_model, name):
30 events = timeline_model.GetAllEventsOfName(name) 37 events = timeline_model.GetAllEventsOfName(name)
31 event_durations = [d.duration for d in events] 38 event_durations = [d.duration for d in events]
32 assert event_durations, 'Failed to find durations' 39 assert event_durations, 'Failed to find durations'
33 40
34 duration_sum = sum(event_durations) 41 duration_sum = sum(event_durations)
35 duration_count = len(event_durations) 42 duration_count = len(event_durations)
36 duration_avg = duration_sum / duration_count 43 duration_avg = duration_sum / duration_count
37 return duration_avg 44 return duration_avg
38 45
46 def CountNumbers(self, timeline_model, name):
47 events = timeline_model.GetAllEventsOfName(name)
48
49 duration_count = len(events)
50 return duration_count
51
39 def ValidateAndMeasurePage(self, page, tab, results): 52 def ValidateAndMeasurePage(self, page, tab, results):
40 del page # unused 53 del page # unused
41 timeline_data = tab.browser.platform.tracing_controller.StopTracing() 54 timeline_data = tab.browser.platform.tracing_controller.StopTracing()
42 timeline_model = model.TimelineModel(timeline_data) 55 timeline_model = model.TimelineModel(timeline_data)
43 56
44 pt_avg = self.ComputeAverageOfDurations( 57 cdp_sum = self.ComputeAverageOfDurations(
45 timeline_model, 58 timeline_model,
46 'LayerTreeHostCommon::ComputeVisibleRectsWithPropertyTrees') 59 'LayerTreeImpl::UpdateDrawProperties::CalculateDrawProperties')
60 results.AddValue(scalar.ScalarValue(
61 results.current_page, 'Impl_cdp_cost', 'ms', cdp_sum,
62 description='Average time spent calculating draw properties'))
47 63
48 results.AddValue(scalar.ScalarValue(
49 results.current_page, 'PT_avg_cost', 'ms', pt_avg,
50 description='Average time spent processing property trees'))
51 64
52 def DidRunPage(self, platform): 65 def DidRunPage(self, platform):
53 tracing_controller = platform.tracing_controller 66 tracing_controller = platform.tracing_controller
54 if tracing_controller.is_tracing_running: 67 if tracing_controller.is_tracing_running:
55 tracing_controller.StopTracing() 68 tracing_controller.StopTracing()
OLDNEW
« tools/perf/benchmarks/draw_properties.py ('K') | « tools/perf/benchmarks/draw_properties.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698