| 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 telemetry.page import page_test | 5 from telemetry.page import page_test |
| 6 from telemetry.timeline.model import TimelineModel | 6 from telemetry.timeline.model import TimelineModel |
| 7 from telemetry.timeline import tracing_config | 7 from telemetry.timeline import tracing_config |
| 8 from telemetry.util import statistics | 8 from telemetry.util import statistics |
| 9 from telemetry.value import scalar | 9 from telemetry.value import scalar |
| 10 | 10 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 'v8', | 34 'v8', |
| 35 'webkit.console'] | 35 'webkit.console'] |
| 36 | 36 |
| 37 def __init__(self): | 37 def __init__(self): |
| 38 super(TaskExecutionTime, self).__init__() | 38 super(TaskExecutionTime, self).__init__() |
| 39 self._renderer_process = None | 39 self._renderer_process = None |
| 40 self._browser_process = None | 40 self._browser_process = None |
| 41 self._results = None | 41 self._results = None |
| 42 | 42 |
| 43 def WillNavigateToPage(self, page, tab): | 43 def WillNavigateToPage(self, page, tab): |
| 44 del page # unused |
| 44 config = tracing_config.TracingConfig() | 45 config = tracing_config.TracingConfig() |
| 45 for category in self._CATEGORIES: | 46 for category in self._CATEGORIES: |
| 46 config.tracing_category_filter.AddIncludedCategory(category) | 47 config.tracing_category_filter.AddIncludedCategory(category) |
| 47 config.enable_chrome_trace = True | 48 config.enable_chrome_trace = True |
| 48 | 49 |
| 49 tab.browser.platform.tracing_controller.StartTracing( | 50 tab.browser.platform.tracing_controller.StartTracing( |
| 50 config, self._TIME_OUT_IN_SECONDS) | 51 config, self._TIME_OUT_IN_SECONDS) |
| 51 | 52 |
| 52 def ValidateAndMeasurePage(self, page, tab, results): | 53 def ValidateAndMeasurePage(self, page, tab, results): |
| 54 del page # unused |
| 53 trace_data = tab.browser.platform.tracing_controller.StopTracing() | 55 trace_data = tab.browser.platform.tracing_controller.StopTracing() |
| 54 timeline_model = TimelineModel(trace_data) | 56 timeline_model = TimelineModel(trace_data) |
| 55 | 57 |
| 56 self._renderer_process = timeline_model.GetRendererProcessFromTabId(tab.id) | 58 self._renderer_process = timeline_model.GetRendererProcessFromTabId(tab.id) |
| 57 self._browser_process = timeline_model.browser_process | 59 self._browser_process = timeline_model.browser_process |
| 58 self._AddResults(results) | 60 self._AddResults(results) |
| 59 | 61 |
| 60 def _AddResults(self, results): | 62 def _AddResults(self, results): |
| 61 self._results = results | 63 self._results = results |
| 62 | 64 |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 def AddTask(self, name, duration): | 218 def AddTask(self, name, duration): |
| 217 if name in self.tasks: | 219 if name in self.tasks: |
| 218 # section_tasks already contains an entry for this (e.g. from an earlier | 220 # section_tasks already contains an entry for this (e.g. from an earlier |
| 219 # slice), add the new duration so we can calculate a median value later. | 221 # slice), add the new duration so we can calculate a median value later. |
| 220 self.tasks[name].Update(duration) | 222 self.tasks[name].Update(duration) |
| 221 else: | 223 else: |
| 222 # This is a new task so create a new entry for it. | 224 # This is a new task so create a new entry for it. |
| 223 self.tasks[name] = NameAndDurations(name, duration) | 225 self.tasks[name] = NameAndDurations(name, duration) |
| 224 # Accumulate total duration for all tasks in this section. | 226 # Accumulate total duration for all tasks in this section. |
| 225 self.total_duration += duration | 227 self.total_duration += duration |
| OLD | NEW |