diff options
Diffstat (limited to 'simpleperf/scripts/run_simpleperf_without_usb_connection.py')
-rwxr-xr-x | simpleperf/scripts/run_simpleperf_without_usb_connection.py | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/simpleperf/scripts/run_simpleperf_without_usb_connection.py b/simpleperf/scripts/run_simpleperf_without_usb_connection.py index 405deb4f..19700ee8 100755 --- a/simpleperf/scripts/run_simpleperf_without_usb_connection.py +++ b/simpleperf/scripts/run_simpleperf_without_usb_connection.py @@ -26,12 +26,13 @@ during profiling time, simpleperf only records the first running. """ -import logging +from __future__ import print_function +import argparse import subprocess import sys import time -from simpleperf_utils import AdbHelper, BaseArgumentParser, get_target_binary_path +from simpleperf_utils import AdbHelper, get_target_binary_path, log_warning def start_recording(args): @@ -45,8 +46,6 @@ def start_recording(args): shell_cmd = 'cd /data/local/tmp && nohup ./simpleperf record ' + args.record_options if args.app: shell_cmd += ' --app ' + args.app - if args.pid: - shell_cmd += ' -p ' + args.pid if args.size_limit: shell_cmd += ' --size-limit ' + args.size_limit shell_cmd += ' >/data/local/tmp/simpleperf_output 2>&1' @@ -66,7 +65,7 @@ def stop_recording(args): adb = AdbHelper() result = adb.run(['shell', 'pidof', 'simpleperf']) if not result: - logging.warning('No simpleperf process on device. The recording has ended.') + log_warning('No simpleperf process on device. The recording has ended.') else: adb.run(['shell', 'pkill', '-l', '2', 'simpleperf']) print('Waiting for simpleperf process to finish...') @@ -78,7 +77,8 @@ def stop_recording(args): def main(): - parser = BaseArgumentParser(description=__doc__) + parser = argparse.ArgumentParser(description=__doc__, + formatter_class=argparse.RawDescriptionHelpFormatter) subparsers = parser.add_subparsers() start_parser = subparsers.add_parser('start', help='Start recording.') start_parser.add_argument('-r', '--record_options', @@ -87,8 +87,6 @@ def main(): Default is `-e task-clock:u -g`.""") start_parser.add_argument('-p', '--app', help="""Profile an Android app, given the package name. Like `-p com.example.android.myapp`.""") - start_parser.add_argument('--pid', help="""Profile an Android app, given the process id. - Like `--pid 918`.""") start_parser.add_argument('--size_limit', type=str, help="""Stop profiling when recording data reaches [size_limit][K|M|G] bytes. Like `--size_limit 1M`.""") |