OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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. |
| 4 |
| 5 from measurements import PageTestMeasurement |
4 from measurements import timeline_controller | 6 from measurements import timeline_controller |
5 from metrics import timeline | 7 from metrics import timeline |
6 from telemetry.core.platform import tracing_category_filter | 8 from telemetry.core.platform import tracing_category_filter |
7 from telemetry.page import page_test | |
8 | 9 |
9 class ThreadTimes(page_test.PageTest): | 10 class ThreadTimes(PageTestMeasurement): |
10 def __init__(self): | 11 def __init__(self): |
11 super(ThreadTimes, self).__init__('RunSmoothness') | 12 super(ThreadTimes, self).__init__('RunSmoothness') |
12 self._timeline_controller = None | 13 self._timeline_controller = None |
13 | 14 |
14 @classmethod | 15 @classmethod |
15 def AddCommandLineArgs(cls, parser): | 16 def AddCommandLineArgs(cls, parser): |
16 parser.add_option('--report-silk-details', action='store_true', | 17 parser.add_option('--report-silk-details', action='store_true', |
17 help='Report details relevant to silk.') | 18 help='Report details relevant to silk.') |
18 | 19 |
19 def WillNavigateToPage(self, page, tab): | 20 def WillNavigateToPage(self, page, tab): |
20 self._timeline_controller = timeline_controller.TimelineController() | 21 self._timeline_controller = timeline_controller.TimelineController() |
21 if self.options.report_silk_details: | 22 if self.options.report_silk_details: |
22 # We need the other traces in order to have any details to report. | 23 # We need the other traces in order to have any details to report. |
23 self._timeline_controller.trace_categories = None | 24 self._timeline_controller.trace_categories = None |
24 else: | 25 else: |
25 self._timeline_controller.trace_categories = \ | 26 self._timeline_controller.trace_categories = \ |
26 tracing_category_filter.CreateNoOverheadFilter().filter_string | 27 tracing_category_filter.CreateNoOverheadFilter().filter_string |
27 self._timeline_controller.SetUp(page, tab) | 28 self._timeline_controller.SetUp(page, tab) |
28 | 29 |
29 def WillRunActions(self, page, tab): | 30 def WillRunActions(self, page, tab): |
30 self._timeline_controller.Start(tab) | 31 self._timeline_controller.Start(tab) |
31 | 32 |
32 def DidRunActions(self, page, tab): | 33 def DidRunActions(self, page, tab): |
33 self._timeline_controller.Stop(tab) | 34 self._timeline_controller.Stop(tab) |
34 | 35 |
35 def ValidateAndMeasurePage(self, page, tab, results): | 36 def ValidateAndMeasurePage(self, page, tab, results): |
| 37 super(ThreadTimes, self).ValidateAndMeasurePage(page, tab, results) |
| 38 |
36 metric = timeline.ThreadTimesTimelineMetric() | 39 metric = timeline.ThreadTimesTimelineMetric() |
37 renderer_thread = \ | 40 renderer_thread = \ |
38 self._timeline_controller.model.GetRendererThreadFromTabId(tab.id) | 41 self._timeline_controller.model.GetRendererThreadFromTabId(tab.id) |
39 if self.options.report_silk_details: | 42 if self.options.report_silk_details: |
40 metric.details_to_report = timeline.ReportSilkDetails | 43 metric.details_to_report = timeline.ReportSilkDetails |
41 metric.AddResults(self._timeline_controller.model, renderer_thread, | 44 metric.AddResults(self._timeline_controller.model, renderer_thread, |
42 self._timeline_controller.smooth_records, results) | 45 self._timeline_controller.smooth_records, results) |
43 | 46 |
44 def CleanUpAfterPage(self, _, tab): | 47 def CleanUpAfterPage(self, _, tab): |
45 self._timeline_controller.CleanUp(tab) | 48 self._timeline_controller.CleanUp(tab) |
OLD | NEW |