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

Unified 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, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/perf/benchmarks/draw_properties.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..a53c03b650344ebb04277bd46abb0ba8973836ea
--- /dev/null
+++ b/tools/perf/measurements/draw_properties.py
@@ -0,0 +1,69 @@
+# 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 ComputeAverageAndSumOfDurations(self, timeline_model, name):
+ events = timeline_model.GetAllEventsOfName(name)
+ event_durations = [d.duration for d in events]
+ assert event_durations, 'Failed to find durations'
+
+ duration_sum = sum(event_durations)
+ duration_count = len(event_durations)
+ duration_avg = duration_sum / duration_count
+ return (duration_avg, duration_sum)
+
+ def ValidateAndMeasurePage(self, page, tab, results):
+ timeline_data = tab.browser.platform.tracing_controller.Stop()
+ timeline_model = model.TimelineModel(timeline_data)
+
+ (cdp_avg, cdp_sum) = self.ComputeAverageAndSumOfDurations(
+ timeline_model,
+ "LayerTreeHostCommon::CalculateDrawProperties");
+
+ (pt_avg, pt_sum) = self.ComputeAverageAndSumOfDurations(
+ timeline_model,
+ "LayerTreeHostCommon::ComputeVisibleRectsWithPropertyTrees");
+
+ 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()
« 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