| 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 os | 5 import os |
| 6 | 6 |
| 7 from telemetry.page import page_test | 7 from telemetry.page import page_test |
| 8 from telemetry.timeline.model import TimelineModel | 8 from telemetry.timeline.model import TimelineModel |
| 9 from telemetry.timeline import tracing_config | 9 from telemetry.timeline import tracing_config |
| 10 from telemetry.value import list_of_scalar_values | 10 from telemetry.value import list_of_scalar_values |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 gc_time += sum(values[key]) | 128 gc_time += sum(values[key]) |
| 129 results.AddValue(scalar.ScalarValue(page, 'oilpan_gc', unit, gc_time)) | 129 results.AddValue(scalar.ScalarValue(page, 'oilpan_gc', unit, gc_time)) |
| 130 | 130 |
| 131 | 131 |
| 132 class _OilpanGCTimesBase(page_test.PageTest): | 132 class _OilpanGCTimesBase(page_test.PageTest): |
| 133 | 133 |
| 134 def __init__(self, action_name=''): | 134 def __init__(self, action_name=''): |
| 135 super(_OilpanGCTimesBase, self).__init__(action_name) | 135 super(_OilpanGCTimesBase, self).__init__(action_name) |
| 136 | 136 |
| 137 def WillNavigateToPage(self, page, tab): | 137 def WillNavigateToPage(self, page, tab): |
| 138 del page # unused |
| 138 # FIXME: Remove webkit.console when blink.console lands in chromium and | 139 # FIXME: Remove webkit.console when blink.console lands in chromium and |
| 139 # the ref builds are updated. crbug.com/386847 | 140 # the ref builds are updated. crbug.com/386847 |
| 140 config = tracing_config.TracingConfig() | 141 config = tracing_config.TracingConfig() |
| 141 for c in ['webkit.console', 'blink.console', 'blink_gc']: | 142 for c in ['webkit.console', 'blink.console', 'blink_gc']: |
| 142 config.tracing_category_filter.AddIncludedCategory(c) | 143 config.tracing_category_filter.AddIncludedCategory(c) |
| 143 config.enable_chrome_trace = True | 144 config.enable_chrome_trace = True |
| 144 tab.browser.platform.tracing_controller.StartTracing(config, timeout=1000) | 145 tab.browser.platform.tracing_controller.StartTracing(config, timeout=1000) |
| 145 | 146 |
| 146 def ValidateAndMeasurePage(self, page, tab, results): | 147 def ValidateAndMeasurePage(self, page, tab, results): |
| 148 del page # unused |
| 147 timeline_data = tab.browser.platform.tracing_controller.StopTracing() | 149 timeline_data = tab.browser.platform.tracing_controller.StopTracing() |
| 148 timeline_model = TimelineModel(timeline_data) | 150 timeline_model = TimelineModel(timeline_data) |
| 149 threads = timeline_model.GetAllThreads() | 151 threads = timeline_model.GetAllThreads() |
| 150 for thread in threads: | 152 for thread in threads: |
| 151 if thread.name == _CR_RENDERER_MAIN: | 153 if thread.name == _CR_RENDERER_MAIN: |
| 152 _AddTracingResults(thread, results) | 154 _AddTracingResults(thread, results) |
| 153 | 155 |
| 154 def DidRunPage(self, platform): | 156 def DidRunPage(self, platform): |
| 155 if platform.tracing_controller.is_tracing_running: | 157 if platform.tracing_controller.is_tracing_running: |
| 156 platform.tracing_controller.StopTracing() | 158 platform.tracing_controller.StopTracing() |
| 157 | 159 |
| 158 | 160 |
| 159 class OilpanGCTimesForSmoothness(_OilpanGCTimesBase): | 161 class OilpanGCTimesForSmoothness(_OilpanGCTimesBase): |
| 160 | 162 |
| 161 def __init__(self): | 163 def __init__(self): |
| 162 super(OilpanGCTimesForSmoothness, self).__init__() | 164 super(OilpanGCTimesForSmoothness, self).__init__() |
| 163 self._interaction = None | 165 self._interaction = None |
| 164 | 166 |
| 165 def DidNavigateToPage(self, page, tab): | 167 def DidNavigateToPage(self, page, tab): |
| 168 del page # unused |
| 166 self._interaction = tab.action_runner.CreateInteraction(_RUN_SMOOTH_ACTIONS) | 169 self._interaction = tab.action_runner.CreateInteraction(_RUN_SMOOTH_ACTIONS) |
| 167 self._interaction.Begin() | 170 self._interaction.Begin() |
| 168 | 171 |
| 169 def ValidateAndMeasurePage(self, page, tab, results): | 172 def ValidateAndMeasurePage(self, page, tab, results): |
| 170 self._interaction.End() | 173 self._interaction.End() |
| 171 super(OilpanGCTimesForSmoothness, self).ValidateAndMeasurePage( | 174 super(OilpanGCTimesForSmoothness, self).ValidateAndMeasurePage( |
| 172 page, tab, results) | 175 page, tab, results) |
| 173 | 176 |
| 174 | 177 |
| 175 class OilpanGCTimesForBlinkPerf(_OilpanGCTimesBase): | 178 class OilpanGCTimesForBlinkPerf(_OilpanGCTimesBase): |
| (...skipping 18 matching lines...) Expand all Loading... |
| 194 | 197 |
| 195 def __init__(self): | 198 def __init__(self): |
| 196 super(OilpanGCTimesForInternals, self).__init__() | 199 super(OilpanGCTimesForInternals, self).__init__() |
| 197 | 200 |
| 198 @classmethod | 201 @classmethod |
| 199 def CustomizeBrowserOptions(cls, options): | 202 def CustomizeBrowserOptions(cls, options): |
| 200 # 'expose-internals-for-testing' can be enabled on content shell. | 203 # 'expose-internals-for-testing' can be enabled on content shell. |
| 201 assert 'content-shell' in options.browser_type | 204 assert 'content-shell' in options.browser_type |
| 202 options.AppendExtraBrowserArgs(['--expose-internals-for-testing', | 205 options.AppendExtraBrowserArgs(['--expose-internals-for-testing', |
| 203 '--js-flags=--expose-gc']) | 206 '--js-flags=--expose-gc']) |
| OLD | NEW |