Index: tools/perf/measurements/draw_properties.py |
diff --git a/tools/perf/measurements/draw_properties.py b/tools/perf/measurements/draw_properties.py |
new file mode 100644 |
index 0000000000000000000000000000000000000000..502a642fac788adf9d3b3b3a59974cb2d81321b8 |
--- /dev/null |
+++ b/tools/perf/measurements/draw_properties.py |
@@ -0,0 +1,74 @@ |
+# Copyright 2015 The Chromium Authors. All rights reserved. |
+# Use of this source code is governed by a BSD-style license that can be |
+# found in the LICENSE file. |
+ |
+from telemetry.core.platform import tracing_category_filter |
+from telemetry.core.platform import tracing_options |
+from telemetry.page import page_test |
+from telemetry.timeline import model |
+from telemetry.value import scalar |
+ |
+ |
+class DrawProperties(page_test.PageTest): |
+ def __init__(self): |
+ super(DrawProperties, self).__init__( |
+ action_name_to_run='RunPageInteractions') |
+ |
+ def CustomizeBrowserOptions(self, options): |
+ options.AppendExtraBrowserArgs([ |
+ '--enable-property-tree-verification', |
+ '--enable-prefer-compositing-to-lcd-text', |
+ ]) |
+ |
+ def WillNavigateToPage(self, page, tab): |
+ options = tracing_options.TracingOptions() |
+ options.enable_chrome_trace = True |
+ category_filter = tracing_category_filter.TracingCategoryFilter( |
+ 'disabled-by-default-cc.debug.cdp-perf') |
+ tab.browser.platform.tracing_controller.Start(options, category_filter) |
+ |
+ def ValidateAndMeasurePage(self, page, tab, results): |
+ timeline_data = tab.browser.platform.tracing_controller.Stop() |
+ timeline_model = model.TimelineModel(timeline_data) |
+ |
+ def _IsDone(): |
+ return tab.EvaluateJavaScript('isDone') |
sullivan
2015/02/26 21:59:02
I think this function is unneeded? I don't see it
Ian Vollick
2015/02/26 22:59:39
Done.
|
+ |
+ cdp_events = timeline_model.GetAllEventsOfName( |
+ "LayerTreeHostCommon::CalculateDrawProperties"); |
+ |
+ cdp_durations = [d.duration for d in cdp_events] |
+ assert cdp_durations, 'Failed to find cdp durations' |
+ |
+ cdp_sum = sum(cdp_durations) |
+ cdp_count = len(cdp_durations) |
+ cdp_avg = cdp_sum / cdp_count |
+ |
+ pt_events = timeline_model.GetAllEventsOfName( |
+ "LayerTreeHostCommon::ComputeVisibleRectsWithPropertyTrees"); |
+ |
+ pt_durations = [d.duration for d in pt_events] |
+ assert pt_durations, 'Failed to find pt durations' |
+ |
+ pt_sum = sum(pt_durations) |
+ pt_count = len(pt_durations) |
+ pt_avg = pt_sum / pt_count |
sullivan
2015/02/26 21:59:02
Could put this duplicated code into a function.
Ian Vollick
2015/02/26 22:59:39
Done.
|
+ |
+ reduction = 100.0 * (1.0 - (pt_sum / cdp_sum)) |
+ |
+ results.AddValue(scalar.ScalarValue( |
+ results.current_page, 'CDP_reduction', ' %', reduction, |
+ description='Reduction in CDP cost with property trees')) |
+ |
+ results.AddValue(scalar.ScalarValue( |
+ results.current_page, 'CDP_avg_cost', 'ms', cdp_avg, |
+ description='Average time spent in CDP')) |
+ |
+ results.AddValue(scalar.ScalarValue( |
+ results.current_page, 'PT_avg_cost', 'ms', pt_avg, |
+ description='Average time spent processing property trees')) |
+ |
+ def CleanUpAfterPage(self, page, tab): |
+ tracing_controller = tab.browser.platform.tracing_controller |
+ if tracing_controller.is_tracing_running: |
+ tracing_controller.Stop() |