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

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

Issue 1132993004: [Android] Remove more references to and uses of AndroidCommands. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
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 logging 5 import logging
6 import os 6 import os
7 import signal 7 import signal
8 import subprocess 8 import subprocess
9 import sys 9 import sys
10 import tempfile 10 import tempfile
(...skipping 29 matching lines...) Expand all
40 # Record raw samples to get CPU information. 40 # Record raw samples to get CPU information.
41 '--raw-samples', 41 '--raw-samples',
42 # Increase sampling frequency for better coverage. 42 # Increase sampling frequency for better coverage.
43 '--freq', '2000', 43 '--freq', '2000',
44 ] 44 ]
45 45
46 46
47 class _PerfProfiler(object): 47 class _PerfProfiler(object):
48 def __init__(self, device, perf_binary, categories): 48 def __init__(self, device, perf_binary, categories):
49 self._device = device 49 self._device = device
50 self._output_file = android_commands.DeviceTempFile( 50 self._output_file = device_temp_file.DeviceTempFile(
Sami 2015/05/13 12:58:51 Missing import?
jbudorick 2015/05/13 21:49:29 Done.
51 self._device.old_interface, prefix='perf_output') 51 self._device.adb, prefix='perf_output')
52 self._log_file = tempfile.TemporaryFile() 52 self._log_file = tempfile.TemporaryFile()
53 53
54 # TODO(jbudorick) Look at providing a way to unhandroll this once the 54 # TODO(jbudorick) Look at providing a way to unhandroll this once the
55 # adb rewrite has fully landed. 55 # adb rewrite has fully landed.
56 device_param = (['-s', str(self._device)] if str(self._device) else []) 56 device_param = (['-s', str(self._device)] if str(self._device) else [])
57 cmd = ['adb'] + device_param + \ 57 cmd = ['adb'] + device_param + \
58 ['shell', perf_binary, 'record', 58 ['shell', perf_binary, 'record',
59 '--output', self._output_file.name] + _PERF_OPTIONS 59 '--output', self._output_file.name] + _PERF_OPTIONS
60 if categories: 60 if categories:
61 cmd += ['--event', ','.join(categories)] 61 cmd += ['--event', ','.join(categories)]
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 open(json_file_name, 'w') as json_file: 179 open(json_file_name, 'w') as json_file:
180 cmd = [perfhost_path, 'script', '-s', perf_script_path, '-i', 180 cmd = [perfhost_path, 'script', '-s', perf_script_path, '-i',
181 perf_profile, '--symfs', symfs_dir, '--kallsyms', kallsyms] 181 perf_profile, '--symfs', symfs_dir, '--kallsyms', kallsyms]
182 if subprocess.call(cmd, stdout=json_file, stderr=dev_null): 182 if subprocess.call(cmd, stdout=json_file, stderr=dev_null):
183 logging.warning('Perf data to JSON conversion failed. The result will ' 183 logging.warning('Perf data to JSON conversion failed. The result will '
184 'not contain any perf samples. You can still view the ' 184 'not contain any perf samples. You can still view the '
185 'perf data manually as shown above.') 185 'perf data manually as shown above.')
186 return None 186 return None
187 187
188 return json_file_name 188 return json_file_name
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698