OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright 2013 The Chromium Authors. All rights reserved. | 3 # Copyright 2013 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 base64 | 7 import base64 |
8 import gzip | 8 import gzip |
9 import logging | 9 import logging |
10 import optparse | 10 import optparse |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 finally: | 318 finally: |
319 _StopTracing(controllers) | 319 _StopTracing(controllers) |
320 if interval: | 320 if interval: |
321 _PrintMessage('done') | 321 _PrintMessage('done') |
322 | 322 |
323 return _PullTraces(controllers, output, compress, write_html) | 323 return _PullTraces(controllers, output, compress, write_html) |
324 | 324 |
325 | 325 |
326 def _ComputeChromeCategories(options): | 326 def _ComputeChromeCategories(options): |
327 categories = [] | 327 categories = [] |
328 if options.trace_cc: | 328 if options.trace_frame_viewer: |
| 329 categories.append('disabled-by-default-cc.debug') |
| 330 if options.trace_ubercompositor: |
329 categories.append('disabled-by-default-cc.debug*') | 331 categories.append('disabled-by-default-cc.debug*') |
330 if options.trace_gpu: | 332 if options.trace_gpu: |
331 categories.append('disabled-by-default-gpu.debug*') | 333 categories.append('disabled-by-default-gpu.debug*') |
332 if options.chrome_categories: | 334 if options.chrome_categories: |
333 categories += options.chrome_categories.split(',') | 335 categories += options.chrome_categories.split(',') |
334 return categories | 336 return categories |
335 | 337 |
336 | 338 |
337 def _ComputeSystraceCategories(options): | 339 def _ComputeSystraceCategories(options): |
338 if not options.systrace_categories: | 340 if not options.systrace_categories: |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 'disabled with "--categories=\'\'".', | 372 'disabled with "--categories=\'\'".', |
371 metavar='CHROME_CATEGORIES', dest='chrome_categories', | 373 metavar='CHROME_CATEGORIES', dest='chrome_categories', |
372 default=_DEFAULT_CHROME_CATEGORIES) | 374 default=_DEFAULT_CHROME_CATEGORIES) |
373 categories.add_option('-s', '--systrace', help='Capture a systrace with the ' | 375 categories.add_option('-s', '--systrace', help='Capture a systrace with the ' |
374 'chosen comma-delimited systrace categories. You can ' | 376 'chosen comma-delimited systrace categories. You can ' |
375 'also capture a combined Chrome + systrace by enabling ' | 377 'also capture a combined Chrome + systrace by enabling ' |
376 'both types of categories. Use "list" to see the ' | 378 'both types of categories. Use "list" to see the ' |
377 'available categories. Systrace is disabled by ' | 379 'available categories. Systrace is disabled by ' |
378 'default.', metavar='SYS_CATEGORIES', | 380 'default.', metavar='SYS_CATEGORIES', |
379 dest='systrace_categories', default='') | 381 dest='systrace_categories', default='') |
380 categories.add_option('--trace-cc', help='Enable extra trace categories for ' | 382 categories.add_option('--trace-cc', |
381 'compositor frame viewer data.', action='store_true') | 383 help='Deprecated, use --trace-frame-viewer.', |
| 384 action='store_true') |
| 385 categories.add_option('--trace-frame-viewer', |
| 386 help='Enable enough trace categories for ' |
| 387 'compositor frame viewing.', action='store_true') |
| 388 categories.add_option('--trace-ubercompositor', |
| 389 help='Enable enough trace categories for ' |
| 390 'ubercompositor frame data.', action='store_true') |
382 categories.add_option('--trace-gpu', help='Enable extra trace categories for ' | 391 categories.add_option('--trace-gpu', help='Enable extra trace categories for ' |
383 'GPU data.', action='store_true') | 392 'GPU data.', action='store_true') |
384 parser.add_option_group(categories) | 393 parser.add_option_group(categories) |
385 | 394 |
386 output_options = optparse.OptionGroup(parser, 'Output options') | 395 output_options = optparse.OptionGroup(parser, 'Output options') |
387 output_options.add_option('-o', '--output', help='Save trace output to file.') | 396 output_options.add_option('-o', '--output', help='Save trace output to file.') |
388 output_options.add_option('--html', help='Package trace into a standalone ' | 397 output_options.add_option('--html', help='Package trace into a standalone ' |
389 'html file.', action='store_true') | 398 'html file.', action='store_true') |
390 output_options.add_option('--view', help='Open resulting trace file in a ' | 399 output_options.add_option('--view', help='Open resulting trace file in a ' |
391 'browser.', action='store_true') | 400 'browser.', action='store_true') |
392 parser.add_option_group(output_options) | 401 parser.add_option_group(output_options) |
393 | 402 |
394 browsers = sorted(_GetSupportedBrowsers().keys()) | 403 browsers = sorted(_GetSupportedBrowsers().keys()) |
395 parser.add_option('-b', '--browser', help='Select among installed browsers. ' | 404 parser.add_option('-b', '--browser', help='Select among installed browsers. ' |
396 'One of ' + ', '.join(browsers) + ', "stable" is used by ' | 405 'One of ' + ', '.join(browsers) + ', "stable" is used by ' |
397 'default.', type='choice', choices=browsers, | 406 'default.', type='choice', choices=browsers, |
398 default='stable') | 407 default='stable') |
399 parser.add_option('-v', '--verbose', help='Verbose logging.', | 408 parser.add_option('-v', '--verbose', help='Verbose logging.', |
400 action='store_true') | 409 action='store_true') |
401 parser.add_option('-z', '--compress', help='Compress the resulting trace ' | 410 parser.add_option('-z', '--compress', help='Compress the resulting trace ' |
402 'with gzip. ', action='store_true') | 411 'with gzip. ', action='store_true') |
403 options, args = parser.parse_args() | 412 options, args = parser.parse_args() |
| 413 if options.trace_cc: |
| 414 parser.parse_error("""--trace-cc is deprecated. |
| 415 |
| 416 For basic jank busting uses, use --trace-frame-viewer |
| 417 For detailed study of ubercompositor, pass --trace-ubercompositor. |
| 418 |
| 419 When in doubt, just try out --trace-frame-viewer. |
| 420 """) |
404 | 421 |
405 if options.verbose: | 422 if options.verbose: |
406 logging.getLogger().setLevel(logging.DEBUG) | 423 logging.getLogger().setLevel(logging.DEBUG) |
407 | 424 |
408 adb = android_commands.AndroidCommands() | 425 adb = android_commands.AndroidCommands() |
409 if options.systrace_categories in ['list', 'help']: | 426 if options.systrace_categories in ['list', 'help']: |
410 _PrintMessage('\n'.join(SystraceController.GetCategories(adb))) | 427 _PrintMessage('\n'.join(SystraceController.GetCategories(adb))) |
411 return 0 | 428 return 0 |
412 | 429 |
413 if not options.time and not options.continuous: | 430 if not options.time and not options.continuous: |
(...skipping 27 matching lines...) Expand all Loading... |
441 options.time if not options.continuous else 0, | 458 options.time if not options.continuous else 0, |
442 options.output, | 459 options.output, |
443 options.compress, | 460 options.compress, |
444 options.html) | 461 options.html) |
445 if options.view: | 462 if options.view: |
446 webbrowser.open(result) | 463 webbrowser.open(result) |
447 | 464 |
448 | 465 |
449 if __name__ == '__main__': | 466 if __name__ == '__main__': |
450 sys.exit(main()) | 467 sys.exit(main()) |
OLD | NEW |