OLD | NEW |
(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 from measurements import timeline_controller |
| 5 from metrics import gpu_timeline |
| 6 from telemetry.core.platform import tracing_category_filter |
| 7 from telemetry.page import page_test |
| 8 from telemetry.web_perf.metrics import layout |
| 9 |
| 10 TOPLEVEL_GL_CATEGORY = 'gpu_toplevel' |
| 11 TOPLEVEL_CATEGORIES = ['disabled-by-default-gpu.device', |
| 12 'disabled-by-default-gpu.service'] |
| 13 |
| 14 |
| 15 class GPUTimes(page_test.PageTest): |
| 16 def __init__(self, action_name_to_run='RunPageInteractions'): |
| 17 super(GPUTimes, self).__init__(action_name_to_run=action_name_to_run) |
| 18 self._timeline_controller = None |
| 19 |
| 20 def WillNavigateToPage(self, page, tab): |
| 21 self._timeline_controller = timeline_controller.TimelineController() |
| 22 self._timeline_controller.trace_categories = ','.join(TOPLEVEL_CATEGORIES) |
| 23 self._timeline_controller.SetUp(page, tab) |
| 24 |
| 25 def WillRunActions(self, page, tab): |
| 26 self._timeline_controller.Start(tab) |
| 27 |
| 28 def ValidateAndMeasurePage(self, page, tab, results): |
| 29 self._timeline_controller.Stop(tab, results) |
| 30 metric = gpu_timeline.GPUTimelineMetric() |
| 31 metric.AddResults(self._timeline_controller.model, None, |
| 32 self._timeline_controller.smooth_records, results) |
| 33 |
| 34 def CleanUpAfterPage(self, _, tab): |
| 35 self._timeline_controller.CleanUp(tab) |
OLD | NEW |