| 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 import logging | 5 import logging |
| 6 import os | 6 import os |
| 7 from collections import defaultdict | 7 from collections import defaultdict |
| 8 | 8 |
| 9 from telemetry.core import util | 9 from telemetry.core import util |
| 10 from telemetry.core.platform import tracing_category_filter | 10 from telemetry.core.platform import tracing_category_filter |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 information. | 133 information. |
| 134 | 134 |
| 135 For information on how to mark up a page to work with | 135 For information on how to mark up a page to work with |
| 136 TimelineBasedMeasurement, refer to the | 136 TimelineBasedMeasurement, refer to the |
| 137 perf.metrics.timeline_interaction_record module. | 137 perf.metrics.timeline_interaction_record module. |
| 138 | 138 |
| 139 """ | 139 """ |
| 140 def __init__(self): | 140 def __init__(self): |
| 141 super(TimelineBasedMeasurement, self).__init__('RunPageInteractions') | 141 super(TimelineBasedMeasurement, self).__init__('RunPageInteractions') |
| 142 | 142 |
| 143 @classmethod | 143 def AddCommandLineArgs(self, parser): |
| 144 def AddCommandLineArgs(cls, parser): | |
| 145 parser.add_option( | 144 parser.add_option( |
| 146 '--overhead-level', dest='overhead_level', type='choice', | 145 '--overhead-level', dest='overhead_level', type='choice', |
| 147 choices=ALL_OVERHEAD_LEVELS, | 146 choices=ALL_OVERHEAD_LEVELS, |
| 148 default=NO_OVERHEAD_LEVEL, | 147 default=NO_OVERHEAD_LEVEL, |
| 149 help='How much overhead to incur during the measurement.') | 148 help='How much overhead to incur during the measurement.') |
| 150 parser.add_option( | 149 parser.add_option( |
| 151 '--trace-dir', dest='trace_dir', type='string', default=None, | 150 '--trace-dir', dest='trace_dir', type='string', default=None, |
| 152 help=('Where to save the trace after the run. If this flag ' | 151 help=('Where to save the trace after the run. If this flag ' |
| 153 'is not set, the trace will not be saved.')) | 152 'is not set, the trace will not be saved.')) |
| 154 | 153 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 | 192 |
| 194 model = model_module.TimelineModel(trace_result) | 193 model = model_module.TimelineModel(trace_result) |
| 195 renderer_thread = model.GetRendererThreadFromTabId(tab.id) | 194 renderer_thread = model.GetRendererThreadFromTabId(tab.id) |
| 196 meta_metrics = _TimelineBasedMetrics( | 195 meta_metrics = _TimelineBasedMetrics( |
| 197 model, renderer_thread, _GetMetricFromMetricType) | 196 model, renderer_thread, _GetMetricFromMetricType) |
| 198 meta_metrics.AddResults(results) | 197 meta_metrics.AddResults(results) |
| 199 | 198 |
| 200 def CleanUpAfterPage(self, page, tab): | 199 def CleanUpAfterPage(self, page, tab): |
| 201 if tab.browser.platform.tracing_controller.is_tracing_running: | 200 if tab.browser.platform.tracing_controller.is_tracing_running: |
| 202 tab.browser.platform.tracing_controller.Stop() | 201 tab.browser.platform.tracing_controller.Stop() |
| OLD | NEW |