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 as timeline_module | 5 from measurements import timeline_controller |
6 from metrics import timeline_interaction_record as tir_module | 6 from metrics import timeline_interaction_record as tir_module |
7 from metrics import smoothness | 7 from metrics import smoothness |
8 from telemetry.page import page_measurement | 8 from telemetry.page import page_measurement |
9 from telemetry.core.timeline import model as model_module | 9 from telemetry.core.timeline import model as model_module |
10 | 10 |
11 | 11 |
12 # TimelineBasedMeasurement considers all instrumentation as producing a single | 12 # TimelineBasedMeasurement considers all instrumentation as producing a single |
13 # timeline. But, depending on the amount of instrumentation that is enabled, | 13 # timeline. But, depending on the amount of instrumentation that is enabled, |
14 # overhead increases. The user of the measurement must therefore chose between | 14 # overhead increases. The user of the measurement must therefore chose between |
15 # a few levels of instrumentation. | 15 # a few levels of instrumentation. |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 '--overhead-level', type='choice', | 100 '--overhead-level', type='choice', |
101 choices=ALL_OVERHEAD_LEVELS, | 101 choices=ALL_OVERHEAD_LEVELS, |
102 default=NO_OVERHEAD_LEVEL, | 102 default=NO_OVERHEAD_LEVEL, |
103 help='How much overhead to incur during the measurement.') | 103 help='How much overhead to incur during the measurement.') |
104 | 104 |
105 def WillNavigateToPage(self, page, tab): | 105 def WillNavigateToPage(self, page, tab): |
106 if not tab.browser.supports_tracing: | 106 if not tab.browser.supports_tracing: |
107 raise Exception('Not supported') | 107 raise Exception('Not supported') |
108 assert self.options.overhead_level in ALL_OVERHEAD_LEVELS | 108 assert self.options.overhead_level in ALL_OVERHEAD_LEVELS |
109 if self.options.overhead_level == NO_OVERHEAD_LEVEL: | 109 if self.options.overhead_level == NO_OVERHEAD_LEVEL: |
110 categories = timeline_module.MINIMAL_TRACE_CATEGORIES | 110 categories = timeline_controller.MINIMAL_TRACE_CATEGORIES |
111 elif self.options.overhead_level == \ | 111 elif self.options.overhead_level == \ |
112 MINIMAL_OVERHEAD_LEVEL: | 112 MINIMAL_OVERHEAD_LEVEL: |
113 categories = '' | 113 categories = '' |
114 else: | 114 else: |
115 categories = '*,disabled-by-default-cc.debug' | 115 categories = '*,disabled-by-default-cc.debug' |
116 categories = ','.join([categories] + page.GetSyntheticDelayCategories()) | 116 categories = ','.join([categories] + page.GetSyntheticDelayCategories()) |
117 tab.browser.StartTracing(categories) | 117 tab.browser.StartTracing(categories) |
118 | 118 |
119 def MeasurePage(self, page, tab, results): | 119 def MeasurePage(self, page, tab, results): |
120 """ Collect all possible metrics and added them to results. """ | 120 """ Collect all possible metrics and added them to results. """ |
121 trace_result = tab.browser.StopTracing() | 121 trace_result = tab.browser.StopTracing() |
122 model = model_module.TimelineModel(trace_result) | 122 model = model_module.TimelineModel(trace_result) |
123 renderer_thread = model.GetRendererThreadFromTab(tab) | 123 renderer_thread = model.GetRendererThreadFromTab(tab) |
124 meta_metrics = _TimelineBasedMetrics(model, renderer_thread) | 124 meta_metrics = _TimelineBasedMetrics(model, renderer_thread) |
125 meta_metrics.AddResults(results) | 125 meta_metrics.AddResults(results) |
OLD | NEW |