| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright 2014 The Chromium Authors. All rights reserved. | 3 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 import logging | 7 import logging |
| 8 import optparse | 8 import optparse |
| 9 import os | 9 import os |
| 10 import sys | 10 import sys |
| 11 import webbrowser | 11 import webbrowser |
| 12 | 12 |
| 13 from profile_chrome import chrome_controller | 13 from profile_chrome import chrome_controller |
| 14 from profile_chrome import ddms_controller | 14 from profile_chrome import ddms_controller |
| 15 from profile_chrome import flags | 15 from profile_chrome import flags |
| 16 from profile_chrome import perf_controller | 16 from profile_chrome import perf_controller |
| 17 from profile_chrome import profiler | 17 from profile_chrome import profiler |
| 18 from profile_chrome import systrace_controller | 18 from profile_chrome import systrace_controller |
| 19 from profile_chrome import ui | 19 from profile_chrome import ui |
| 20 | 20 |
| 21 from pylib import android_commands | |
| 22 from pylib.device import device_utils | 21 from pylib.device import device_utils |
| 23 | 22 |
| 24 | 23 |
| 25 _DEFAULT_CHROME_CATEGORIES = '_DEFAULT_CHROME_CATEGORIES' | 24 _DEFAULT_CHROME_CATEGORIES = '_DEFAULT_CHROME_CATEGORIES' |
| 26 | 25 |
| 27 | 26 |
| 28 def _ComputeChromeCategories(options): | 27 def _ComputeChromeCategories(options): |
| 29 categories = [] | 28 categories = [] |
| 30 if options.trace_frame_viewer: | 29 if options.trace_frame_viewer: |
| 31 categories.append('disabled-by-default-cc.debug') | 30 categories.append('disabled-by-default-cc.debug') |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 | 162 |
| 164 For basic jank busting uses, use --trace-frame-viewer | 163 For basic jank busting uses, use --trace-frame-viewer |
| 165 For detailed study of ubercompositor, pass --trace-ubercompositor. | 164 For detailed study of ubercompositor, pass --trace-ubercompositor. |
| 166 | 165 |
| 167 When in doubt, just try out --trace-frame-viewer. | 166 When in doubt, just try out --trace-frame-viewer. |
| 168 """) | 167 """) |
| 169 | 168 |
| 170 if options.verbose: | 169 if options.verbose: |
| 171 logging.getLogger().setLevel(logging.DEBUG) | 170 logging.getLogger().setLevel(logging.DEBUG) |
| 172 | 171 |
| 173 devices = android_commands.GetAttachedDevices() | 172 devices = device_utils.DeviceUtils.HealthyDevices() |
| 174 device = None | 173 device = None |
| 175 if options.device in devices: | 174 if options.device: |
| 176 device = options.device | 175 device = next((d for d in devices if d == options.device), None) |
| 177 elif not options.device and len(devices) == 1: | 176 elif len(devices) == 1: |
| 178 device = devices[0] | 177 device = devices[0] |
| 178 |
| 179 if not device: | 179 if not device: |
| 180 parser.error('Use -d/--device to select a device:\n' + '\n'.join(devices)) | 180 parser.error('Use -d/--device to select a device:\n' + '\n'.join(devices)) |
| 181 device = device_utils.DeviceUtils(device) | |
| 182 package_info = profiler.GetSupportedBrowsers()[options.browser] | 181 package_info = profiler.GetSupportedBrowsers()[options.browser] |
| 183 | 182 |
| 184 if options.chrome_categories in ['list', 'help']: | 183 if options.chrome_categories in ['list', 'help']: |
| 185 ui.PrintMessage('Collecting record categories list...', eol='') | 184 ui.PrintMessage('Collecting record categories list...', eol='') |
| 186 record_categories = [] | 185 record_categories = [] |
| 187 disabled_by_default_categories = [] | 186 disabled_by_default_categories = [] |
| 188 record_categories, disabled_by_default_categories = \ | 187 record_categories, disabled_by_default_categories = \ |
| 189 chrome_controller.ChromeTracingController.GetCategories( | 188 chrome_controller.ChromeTracingController.GetCategories( |
| 190 device, package_info) | 189 device, package_info) |
| 191 | 190 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 enabled_controllers, | 256 enabled_controllers, |
| 258 options.time if not options.continuous else 0, | 257 options.time if not options.continuous else 0, |
| 259 output=options.output, | 258 output=options.output, |
| 260 compress=options.compress, | 259 compress=options.compress, |
| 261 write_json=options.json) | 260 write_json=options.json) |
| 262 if options.view: | 261 if options.view: |
| 263 if sys.platform == 'darwin': | 262 if sys.platform == 'darwin': |
| 264 os.system('/usr/bin/open %s' % os.path.abspath(result)) | 263 os.system('/usr/bin/open %s' % os.path.abspath(result)) |
| 265 else: | 264 else: |
| 266 webbrowser.open(result) | 265 webbrowser.open(result) |
| OLD | NEW |