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

Side by Side Diff: tools/profile_chrome/main.py

Issue 944143002: tools/profile_chrome.py -d to select one of multiple connected android devices. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 For basic jank busting uses, use --trace-frame-viewer 158 For basic jank busting uses, use --trace-frame-viewer
159 For detailed study of ubercompositor, pass --trace-ubercompositor. 159 For detailed study of ubercompositor, pass --trace-ubercompositor.
160 160
161 When in doubt, just try out --trace-frame-viewer. 161 When in doubt, just try out --trace-frame-viewer.
162 """) 162 """)
163 163
164 if options.verbose: 164 if options.verbose:
165 logging.getLogger().setLevel(logging.DEBUG) 165 logging.getLogger().setLevel(logging.DEBUG)
166 166
167 devices = android_commands.GetAttachedDevices() 167 devices = android_commands.GetAttachedDevices()
168 if not options.device and len(devices) != 1: 168 device = None
169 parser.error('Exactly 1 device must be attached.') 169 if options.device in devices:
170 device = device_utils.DeviceUtils( 170 device = options.device
171 next((d for d in devices if d == options.device), devices[0])) 171 elif not options.device and len(devices) == 1:
172 device = devices[0]
173 if not device:
174 parser.error('Use -d/--device to select a device:\n' + '\n'.join(devices))
175 device = device_utils.DeviceUtils(device)
172 package_info = profiler.GetSupportedBrowsers()[options.browser] 176 package_info = profiler.GetSupportedBrowsers()[options.browser]
173 177
174 if options.chrome_categories in ['list', 'help']: 178 if options.chrome_categories in ['list', 'help']:
175 ui.PrintMessage('Collecting record categories list...', eol='') 179 ui.PrintMessage('Collecting record categories list...', eol='')
176 record_categories = [] 180 record_categories = []
177 disabled_by_default_categories = [] 181 disabled_by_default_categories = []
178 record_categories, disabled_by_default_categories = \ 182 record_categories, disabled_by_default_categories = \
179 chrome_controller.ChromeTracingController.GetCategories( 183 chrome_controller.ChromeTracingController.GetCategories(
180 device, package_info) 184 device, package_info)
181 185
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 enabled_controllers, 246 enabled_controllers,
243 options.time if not options.continuous else 0, 247 options.time if not options.continuous else 0,
244 output=options.output, 248 output=options.output,
245 compress=options.compress, 249 compress=options.compress,
246 write_json=options.json) 250 write_json=options.json)
247 if options.view: 251 if options.view:
248 if sys.platform == 'darwin': 252 if sys.platform == 'darwin':
249 os.system('/usr/bin/open %s' % os.path.abspath(result)) 253 os.system('/usr/bin/open %s' % os.path.abspath(result))
250 else: 254 else:
251 webbrowser.open(result) 255 webbrowser.open(result)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698