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

Side by Side Diff: build/android/adb_profile_chrome.py

Issue 153743008: Revert of Enable presubmit pylint in build/android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merging with changes to pylib/linker/test_case.py. Created 6 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 | « build/android/adb_logcat_printer.py ('k') | build/android/asan_symbolize.py » ('j') | 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 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 </head> 58 </head>
59 <body> 59 <body>
60 <div class="view"></view> 60 <div class="view"></view>
61 </body> 61 </body>
62 </html>""" 62 </html>"""
63 63
64 _DEFAULT_CHROME_CATEGORIES = '_DEFAULT_CHROME_CATEGORIES' 64 _DEFAULT_CHROME_CATEGORIES = '_DEFAULT_CHROME_CATEGORIES'
65 65
66 66
67 def _GetTraceTimestamp(): 67 def _GetTraceTimestamp():
68 return time.strftime('%Y-%m-%d-%H%M%S', time.localtime()) 68 return time.strftime('%Y-%m-%d-%H%M%S', time.localtime())
69 69
70 70
71 def _PackageTraceAsHtml(trace_file_name, html_file_name): 71 def _PackageTraceAsHtml(trace_file_name, html_file_name):
72 trace_viewer_root = os.path.join(constants.DIR_SOURCE_ROOT, 72 trace_viewer_root = os.path.join(constants.DIR_SOURCE_ROOT,
73 'third_party', 'trace-viewer') 73 'third_party', 'trace-viewer')
74 build_dir = os.path.join(trace_viewer_root, 'build') 74 build_dir = os.path.join(trace_viewer_root, 'build')
75 src_dir = os.path.join(trace_viewer_root, 'src') 75 src_dir = os.path.join(trace_viewer_root, 'src')
76 if not build_dir in sys.path: 76 if not build_dir in sys.path:
77 sys.path.append(build_dir) 77 sys.path.append(build_dir)
78 generate = __import__('generate', {}, {}) 78 generate = __import__('generate', {}, {})
79 parse_deps = __import__('parse_deps', {}, {}) 79 parse_deps = __import__('parse_deps', {}, {})
80 80
81 basename = os.path.splitext(trace_file_name)[0]
81 load_sequence = parse_deps.calc_load_sequence( 82 load_sequence = parse_deps.calc_load_sequence(
82 ['tracing/standalone_timeline_view.js'], [src_dir]) 83 ['tracing/standalone_timeline_view.js'], [src_dir])
83 84
84 with open(trace_file_name) as trace_file: 85 with open(trace_file_name) as trace_file:
85 trace_data = base64.b64encode(trace_file.read()) 86 trace_data = base64.b64encode(trace_file.read())
86 with open(html_file_name, 'w') as html_file: 87 with open(html_file_name, 'w') as html_file:
87 html = _TRACE_VIEWER_TEMPLATE % { 88 html = _TRACE_VIEWER_TEMPLATE % {
88 'title': os.path.basename(os.path.splitext(trace_file_name)[0]), 89 'title': os.path.basename(os.path.splitext(trace_file_name)[0]),
89 'timeline_js': generate.generate_js(load_sequence), 90 'timeline_js': generate.generate_js(load_sequence),
90 'timeline_css': generate.generate_css(load_sequence), 91 'timeline_css': generate.generate_css(load_sequence),
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 self._thread = None 168 self._thread = None
168 self._trace_data = None 169 self._trace_data = None
169 170
170 def __str__(self): 171 def __str__(self):
171 return 'systrace' 172 return 'systrace'
172 173
173 @staticmethod 174 @staticmethod
174 def GetCategories(adb): 175 def GetCategories(adb):
175 return adb.RunShellCommand('atrace --list_categories') 176 return adb.RunShellCommand('atrace --list_categories')
176 177
177 def StartTracing(self, _): 178 def StartTracing(self, interval):
178 self._thread = threading.Thread(target=self._CollectData) 179 self._thread = threading.Thread(target=self._CollectData)
179 self._thread.start() 180 self._thread.start()
180 181
181 def StopTracing(self): 182 def StopTracing(self):
182 self._done.set() 183 self._done.set()
183 184
184 def PullTrace(self): 185 def PullTrace(self):
185 self._thread.join() 186 self._thread.join()
186 self._thread = None 187 self._thread = None
187 if self._trace_data: 188 if self._trace_data:
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 393
393 browsers = sorted(_GetSupportedBrowsers().keys()) 394 browsers = sorted(_GetSupportedBrowsers().keys())
394 parser.add_option('-b', '--browser', help='Select among installed browsers. ' 395 parser.add_option('-b', '--browser', help='Select among installed browsers. '
395 'One of ' + ', '.join(browsers) + ', "stable" is used by ' 396 'One of ' + ', '.join(browsers) + ', "stable" is used by '
396 'default.', type='choice', choices=browsers, 397 'default.', type='choice', choices=browsers,
397 default='stable') 398 default='stable')
398 parser.add_option('-v', '--verbose', help='Verbose logging.', 399 parser.add_option('-v', '--verbose', help='Verbose logging.',
399 action='store_true') 400 action='store_true')
400 parser.add_option('-z', '--compress', help='Compress the resulting trace ' 401 parser.add_option('-z', '--compress', help='Compress the resulting trace '
401 'with gzip. ', action='store_true') 402 'with gzip. ', action='store_true')
402 options, _ = parser.parse_args() 403 options, args = parser.parse_args()
403 404
404 if options.verbose: 405 if options.verbose:
405 logging.getLogger().setLevel(logging.DEBUG) 406 logging.getLogger().setLevel(logging.DEBUG)
406 407
407 adb = android_commands.AndroidCommands() 408 adb = android_commands.AndroidCommands()
408 if options.systrace_categories in ['list', 'help']: 409 if options.systrace_categories in ['list', 'help']:
409 _PrintMessage('\n'.join(SystraceController.GetCategories(adb))) 410 _PrintMessage('\n'.join(SystraceController.GetCategories(adb)))
410 return 0 411 return 0
411 412
412 if not options.time and not options.continuous: 413 if not options.time and not options.continuous:
(...skipping 27 matching lines...) Expand all
440 options.time if not options.continuous else 0, 441 options.time if not options.continuous else 0,
441 options.output, 442 options.output,
442 options.compress, 443 options.compress,
443 options.html) 444 options.html)
444 if options.view: 445 if options.view:
445 webbrowser.open(result) 446 webbrowser.open(result)
446 447
447 448
448 if __name__ == '__main__': 449 if __name__ == '__main__':
449 sys.exit(main()) 450 sys.exit(main())
OLDNEW
« no previous file with comments | « build/android/adb_logcat_printer.py ('k') | build/android/asan_symbolize.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698