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 | 4 |
5 from metrics import timeline | 5 from metrics import timeline |
6 from telemetry.page import page_measurement | 6 from telemetry.page import page_measurement |
7 | 7 |
8 class ThreadTimes(page_measurement.PageMeasurement): | 8 class ThreadTimes(page_measurement.PageMeasurement): |
9 def __init__(self): | 9 def __init__(self): |
10 super(ThreadTimes, self).__init__('smoothness') | 10 super(ThreadTimes, self).__init__('smoothness') |
11 self._metric = timeline.ThreadTimesTimelineMetric() | 11 self._metric = timeline.ThreadTimesTimelineMetric() |
12 | 12 |
13 def AddCommandLineOptions(self, parser): | 13 def AddCommandLineOptions(self, parser): |
14 parser.add_option('--report-renderer-main-details', action='store_true', | 14 parser.add_option('--report-silk-results', action='store_true', |
15 help='Report details on the render main thread.') | 15 help='Report results relevant to silk.') |
| 16 parser.add_option('--report-silk-details', action='store_true', |
| 17 help='Report details relevant to silk.') |
16 | 18 |
17 def CanRunForPage(self, page): | 19 def CanRunForPage(self, page): |
18 return hasattr(page, 'smoothness') | 20 return hasattr(page, 'smoothness') |
19 | 21 |
20 @property | 22 @property |
21 def results_are_the_same_on_every_page(self): | 23 def results_are_the_same_on_every_page(self): |
22 return False | 24 return False |
23 | 25 |
24 def WillRunActions(self, page, tab): | 26 def WillRunActions(self, page, tab): |
25 self._metric.Start(page, tab) | 27 self._metric.Start(page, tab) |
26 self._metric.report_renderer_main_details = \ | 28 if self.options.report_silk_results: |
27 self.options.report_renderer_main_details | 29 self._metric.results_to_report = timeline.SilkResults |
| 30 if self.options.report_silk_details: |
| 31 self._metric.details_to_report = timeline.SilkDetails |
28 | 32 |
29 def DidRunActions(self, page, tab): | 33 def DidRunActions(self, page, tab): |
30 self._metric.Stop(page, tab) | 34 self._metric.Stop(page, tab) |
31 | 35 |
32 def MeasurePage(self, page, tab, results): | 36 def MeasurePage(self, page, tab, results): |
33 self._metric.AddResults(tab, results) | 37 self._metric.AddResults(tab, results) |
OLD | NEW |