diff options
Diffstat (limited to 'simpleperf/scripts/app_profiler.py')
-rwxr-xr-x | simpleperf/scripts/app_profiler.py | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/simpleperf/scripts/app_profiler.py b/simpleperf/scripts/app_profiler.py index 0080b7f9..e45580af 100755 --- a/simpleperf/scripts/app_profiler.py +++ b/simpleperf/scripts/app_profiler.py @@ -30,7 +30,7 @@ import sys import time from utils import AdbHelper, bytes_to_str, extant_dir, get_script_dir, get_target_binary_path -from utils import log_debug, log_info, log_exit, ReadElf, remove, set_log_level, str_to_bytes +from utils import log_debug, log_info, log_exit, ReadElf, remove, str_to_bytes NATIVE_LIBS_DIR_ON_DEVICE = '/data/local/tmp/native_libs/' @@ -117,12 +117,6 @@ class NativeLibDownloader(object): self.adb.check_run(['shell', 'mkdir', '-p', self.dir_on_device]) if os.path.exists(self.build_id_list_file): os.remove(self.build_id_list_file) - result, output = self.adb.run_and_return_output(['shell', 'ls', self.dir_on_device]) - if not result: - return - file_set = set(output.strip().split()) - if self.build_id_list_file not in file_set: - return self.adb.run(['pull', self.dir_on_device + self.build_id_list_file]) if os.path.exists(self.build_id_list_file): with open(self.build_id_list_file, 'rb') as fh: @@ -130,9 +124,7 @@ class NativeLibDownloader(object): line = bytes_to_str(line).strip() items = line.split('=') if len(items) == 2: - build_id, filename = items - if filename in file_set: - self.device_build_id_map[build_id] = filename + self.device_build_id_map[items[0]] = items[1] remove(self.build_id_list_file) def sync_natives_libs_on_device(self): @@ -203,12 +195,11 @@ class ProfilerBase(object): """Start simpleperf reocrd process on device.""" args = ['/data/local/tmp/simpleperf', 'record', '-o', '/data/local/tmp/perf.data', self.args.record_options] - if self.adb.run(['shell', 'ls', NATIVE_LIBS_DIR_ON_DEVICE, '>/dev/null', '2>&1']): + if self.adb.run(['shell', 'ls', NATIVE_LIBS_DIR_ON_DEVICE]): args += ['--symfs', NATIVE_LIBS_DIR_ON_DEVICE] - args += ['--log', self.args.log] args += target_args adb_args = [self.adb.adb_path, 'shell'] + args - log_info('run adb cmd: %s' % adb_args) + log_debug('run adb cmd: %s' % adb_args) self.record_subproc = subprocess.Popen(adb_args) def wait_profiling(self): @@ -245,7 +236,7 @@ class ProfilerBase(object): if not self.args.skip_collect_binaries: binary_cache_args = [sys.executable, os.path.join(get_script_dir(), 'binary_cache_builder.py')] - binary_cache_args += ['-i', self.args.perf_data_path, '--log', self.args.log] + binary_cache_args += ['-i', self.args.perf_data_path] if self.args.native_lib_dir: binary_cache_args += ['-lib', self.args.native_lib_dir] if self.args.disable_adb_root: @@ -426,15 +417,12 @@ def main(): help="""Force adb to run in non root mode. By default, app_profiler.py will try to switch to root mode to be able to profile released Android apps.""") - other_group.add_argument( - '--log', choices=['debug', 'info', 'warning'], default='info', help='set log level') def check_args(args): if (not args.app) and (args.compile_java_code or args.activity or args.test): log_exit('--compile_java_code, -a, -t can only be used when profiling an Android app.') args = parser.parse_args() - set_log_level(args.log) check_args(args) if args.app: profiler = AppProfiler(args) |