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

Side by Side Diff: build/android/chrome_profiler/profiler.py

Issue 293193002: adb_profile_chrome: Add perf profiler (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 6 years, 6 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 | Annotate | Revision Log
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 gzip 5 import gzip
6 import os 6 import os
7 import shutil 7 import shutil
8 import sys 8 import sys
9 import zipfile 9 import zipfile
10 10
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 controller.StartTracing(interval) 46 controller.StartTracing(interval)
47 47
48 48
49 def _StopTracing(controllers): 49 def _StopTracing(controllers):
50 for controller in controllers: 50 for controller in controllers:
51 controller.StopTracing() 51 controller.StopTracing()
52 52
53 53
54 def _PullTraces(controllers, output, compress, write_json): 54 def _PullTraces(controllers, output, compress, write_json):
55 ui.PrintMessage('Downloading...', eol='') 55 ui.PrintMessage('Downloading...', eol='')
56 trace_files = [] 56 trace_files = [controller.PullTrace() for controller in controllers]
57 for controller in controllers:
58 trace_files.append(controller.PullTrace())
59 57
60 if not write_json: 58 if not write_json:
61 html_file = os.path.splitext(trace_files[0])[0] + '.html' 59 html_file = os.path.splitext(trace_files[0])[0] + '.html'
62 _PackageTracesAsHtml(trace_files, html_file) 60 _PackageTracesAsHtml(trace_files, html_file)
63 trace_files = [html_file] 61 trace_files = [html_file]
64 62
65 if compress and len(trace_files) == 1: 63 if compress and len(trace_files) == 1:
66 result = output or trace_files[0] + '.gz' 64 result = output or trace_files[0] + '.gz'
67 _CompressFile(trace_files[0], result) 65 _CompressFile(trace_files[0], result)
68 elif len(trace_files) > 1: 66 elif len(trace_files) > 1:
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 else: 119 else:
122 ui.PrintMessage('Capturing %s. Press Enter to stop...' % \ 120 ui.PrintMessage('Capturing %s. Press Enter to stop...' % \
123 trace_type, eol='') 121 trace_type, eol='')
124 raw_input() 122 raw_input()
125 finally: 123 finally:
126 _StopTracing(controllers) 124 _StopTracing(controllers)
127 if interval: 125 if interval:
128 ui.PrintMessage('done') 126 ui.PrintMessage('done')
129 127
130 return _PullTraces(controllers, output, compress, write_json) 128 return _PullTraces(controllers, output, compress, write_json)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698