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

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

Issue 918633003: Add a telemetry measurement for property tree performance. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 9 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
« no previous file with comments | « tools/perf/benchmarks/draw_properties.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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.
4
5 from telemetry.core.platform import tracing_category_filter
6 from telemetry.core.platform import tracing_options
7 from telemetry.page import page_test
8 from telemetry.timeline import model
9 from telemetry.value import scalar
10
11
12 class DrawProperties(page_test.PageTest):
13 def __init__(self):
14 super(DrawProperties, self).__init__(
15 action_name_to_run='RunPageInteractions')
16
17 def CustomizeBrowserOptions(self, options):
18 options.AppendExtraBrowserArgs([
19 '--enable-property-tree-verification',
20 '--enable-prefer-compositing-to-lcd-text',
21 ])
22
23 def WillNavigateToPage(self, page, tab):
24 options = tracing_options.TracingOptions()
25 options.enable_chrome_trace = True
26 category_filter = tracing_category_filter.TracingCategoryFilter(
27 'disabled-by-default-cc.debug.cdp-perf')
28 tab.browser.platform.tracing_controller.Start(options, category_filter)
29
30 def ComputeAverageAndSumOfDurations(self, timeline_model, name):
31 events = timeline_model.GetAllEventsOfName(name)
32 event_durations = [d.duration for d in events]
33 assert event_durations, 'Failed to find durations'
34
35 duration_sum = sum(event_durations)
36 duration_count = len(event_durations)
37 duration_avg = duration_sum / duration_count
38 return (duration_avg, duration_sum)
39
40 def ValidateAndMeasurePage(self, page, tab, results):
41 timeline_data = tab.browser.platform.tracing_controller.Stop()
42 timeline_model = model.TimelineModel(timeline_data)
43
44 (cdp_avg, cdp_sum) = self.ComputeAverageAndSumOfDurations(
45 timeline_model,
46 "LayerTreeHostCommon::CalculateDrawProperties");
47
48 (pt_avg, pt_sum) = self.ComputeAverageAndSumOfDurations(
49 timeline_model,
50 "LayerTreeHostCommon::ComputeVisibleRectsWithPropertyTrees");
51
52 reduction = 100.0 * (1.0 - (pt_sum / cdp_sum))
53
54 results.AddValue(scalar.ScalarValue(
55 results.current_page, 'CDP_reduction', ' %', reduction,
56 description='Reduction in CDP cost with property trees'))
57
58 results.AddValue(scalar.ScalarValue(
59 results.current_page, 'CDP_avg_cost', 'ms', cdp_avg,
60 description='Average time spent in CDP'))
61
62 results.AddValue(scalar.ScalarValue(
63 results.current_page, 'PT_avg_cost', 'ms', pt_avg,
64 description='Average time spent processing property trees'))
65
66 def CleanUpAfterPage(self, page, tab):
67 tracing_controller = tab.browser.platform.tracing_controller
68 if tracing_controller.is_tracing_running:
69 tracing_controller.Stop()
OLDNEW
« no previous file with comments | « tools/perf/benchmarks/draw_properties.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698