Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Side by Side Diff: tools/telemetry/telemetry/page/page_runner.py

Issue 511653002: Add profiling_controller that manages profilers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: s/profilers_controller/profiling_controller Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 collections 5 import collections
6 import logging 6 import logging
7 import optparse 7 import optparse
8 import os 8 import os
9 import random 9 import random
10 import sys 10 import sys
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 self._append_to_existing_wpr = True 128 self._append_to_existing_wpr = True
129 129
130 def StartProfiling(self, page, finder_options): 130 def StartProfiling(self, page, finder_options):
131 if not self.profiler_dir: 131 if not self.profiler_dir:
132 self.profiler_dir = tempfile.mkdtemp() 132 self.profiler_dir = tempfile.mkdtemp()
133 output_file = os.path.join(self.profiler_dir, page.file_safe_name) 133 output_file = os.path.join(self.profiler_dir, page.file_safe_name)
134 is_repeating = (finder_options.page_repeat != 1 or 134 is_repeating = (finder_options.page_repeat != 1 or
135 finder_options.pageset_repeat != 1) 135 finder_options.pageset_repeat != 1)
136 if is_repeating: 136 if is_repeating:
137 output_file = util.GetSequentialFileName(output_file) 137 output_file = util.GetSequentialFileName(output_file)
138 self.browser.StartProfiling(finder_options.profiler, output_file) 138 self.browser.platform.profiling_controller.StartProfiling(
139 finder_options.profiler, output_file)
139 140
140 def StopProfiling(self): 141 def StopProfiling(self):
141 if self.browser: 142 if self.browser:
142 self.browser.StopProfiling() 143 self.browser.platform.profiling_controller.StopProfiling()
143 144
144 145
145 class PageState(object): 146 class PageState(object):
146 def __init__(self, page, tab): 147 def __init__(self, page, tab):
147 self.page = page 148 self.page = page
148 self.tab = tab 149 self.tab = tab
149 150
150 self._did_login = False 151 self._did_login = False
151 152
152 def PreparePage(self, test=None): 153 def PreparePage(self, test=None):
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 logging.warning('Device is thermally throttled before running ' 588 logging.warning('Device is thermally throttled before running '
588 'performance tests, results will vary.') 589 'performance tests, results will vary.')
589 590
590 591
591 def _CheckThermalThrottling(platform): 592 def _CheckThermalThrottling(platform):
592 if not platform.CanMonitorThermalThrottling(): 593 if not platform.CanMonitorThermalThrottling():
593 return 594 return
594 if platform.HasBeenThermallyThrottled(): 595 if platform.HasBeenThermallyThrottled():
595 logging.warning('Device has been thermally throttled during ' 596 logging.warning('Device has been thermally throttled during '
596 'performance tests, results will vary.') 597 'performance tests, results will vary.')
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698