| 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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 elif len(trace_files) > 1: | 243 elif len(trace_files) > 1: |
| 244 result = output or 'chrome-combined-trace-%s.zip' % _GetTraceTimestamp() | 244 result = output or 'chrome-combined-trace-%s.zip' % _GetTraceTimestamp() |
| 245 _ArchiveFiles(trace_files, result) | 245 _ArchiveFiles(trace_files, result) |
| 246 elif output: | 246 elif output: |
| 247 result = output | 247 result = output |
| 248 shutil.move(trace_files[0], result) | 248 shutil.move(trace_files[0], result) |
| 249 else: | 249 else: |
| 250 result = trace_files[0] | 250 result = trace_files[0] |
| 251 | 251 |
| 252 _PrintMessage('done') | 252 _PrintMessage('done') |
| 253 _PrintMessage('Trace written to %s' % os.path.abspath(result)) | 253 _PrintMessage('Trace written to file://%s' % os.path.abspath(result)) |
| 254 return result | 254 return result |
| 255 | 255 |
| 256 | 256 |
| 257 def _CaptureAndPullTrace(controllers, interval, output, compress, write_json): | 257 def _CaptureAndPullTrace(controllers, interval, output, compress, write_json): |
| 258 trace_type = ' + '.join(map(str, controllers)) | 258 trace_type = ' + '.join(map(str, controllers)) |
| 259 try: | 259 try: |
| 260 _StartTracing(controllers, interval) | 260 _StartTracing(controllers, interval) |
| 261 if interval: | 261 if interval: |
| 262 _PrintMessage('Capturing %d-second %s. Press Enter to stop early...' % \ | 262 _PrintMessage('Capturing %d-second %s. Press Enter to stop early...' % \ |
| 263 (interval, trace_type), eol='') | 263 (interval, trace_type), eol='') |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 options.json) | 417 options.json) |
| 418 if options.view: | 418 if options.view: |
| 419 if sys.platform == 'darwin': | 419 if sys.platform == 'darwin': |
| 420 os.system('/usr/bin/open %s' % os.path.abspath(result)) | 420 os.system('/usr/bin/open %s' % os.path.abspath(result)) |
| 421 else: | 421 else: |
| 422 webbrowser.open(result) | 422 webbrowser.open(result) |
| 423 | 423 |
| 424 | 424 |
| 425 if __name__ == '__main__': | 425 if __name__ == '__main__': |
| 426 sys.exit(main()) | 426 sys.exit(main()) |
| OLD | NEW |