Beispiel #1
0
def start_recording(args):
    adb = AdbHelper()
    device_arch = adb.get_device_arch()
    simpleperf_binary = get_target_binary_path(device_arch, 'simpleperf')
    adb.check_run(['push', simpleperf_binary, '/data/local/tmp'])
    adb.check_run(['shell', 'chmod', 'a+x', '/data/local/tmp/simpleperf'])
    adb.check_run([
        'shell', 'rm', '-rf', '/data/local/tmp/perf.data',
        '/data/local/tmp/simpleperf_output'
    ])
    shell_cmd = 'cd /data/local/tmp && nohup ./simpleperf record ' + args.record_options
    if args.app:
        shell_cmd += ' --app ' + args.app
    if args.size_limit:
        shell_cmd += ' --size-limit ' + args.size_limit
    shell_cmd += ' >/data/local/tmp/simpleperf_output 2>&1'
    print('shell_cmd: %s' % shell_cmd)
    subproc = subprocess.Popen([adb.adb_path, 'shell', shell_cmd])
    # Wait 2 seconds to see if the simpleperf command fails to start.
    time.sleep(2)
    if subproc.poll() is None:
        print(
            'Simpleperf recording has started. Please unplug the usb cable and run the app.'
        )
        print('After that, run `%s stop` to get recording result.' %
              sys.argv[0])
    else:
        adb.run(['shell', 'cat', '/data/local/tmp/simpleperf_output'])
        sys.exit(subproc.returncode)
def main():
    disable_debug_log()
    adb = AdbHelper()
    device_arch = adb.get_device_arch()
    simpleperf_binary = get_target_binary_path(device_arch, 'simpleperf')
    adb.check_run(['push', simpleperf_binary, '/data/local/tmp'])
    adb.check_run(['shell', 'chmod', 'a+x', '/data/local/tmp/simpleperf'])
    shell_cmd = 'cd /data/local/tmp && ./simpleperf ' + ' '.join(sys.argv[1:])
    sys.exit(subprocess.call([adb.adb_path, 'shell', shell_cmd]))
Beispiel #3
0
def main():
    disable_debug_log()
    adb = AdbHelper()
    device_arch = adb.get_device_arch()
    simpleperf_binary = get_target_binary_path(device_arch, 'simpleperf')
    adb.check_run(['push', simpleperf_binary, '/data/local/tmp'])
    adb.check_run(['shell', 'chmod', 'a+x', '/data/local/tmp/simpleperf'])
    shell_cmd = 'cd /data/local/tmp && ./simpleperf ' + ' '.join(sys.argv[1:])
    sys.exit(subprocess.call([adb.adb_path, 'shell', shell_cmd]))
def start_recording(args):
    adb = AdbHelper()
    device_arch = adb.get_device_arch()
    simpleperf_binary = get_target_binary_path(device_arch, 'simpleperf')
    adb.check_run(['push', simpleperf_binary, '/data/local/tmp'])
    adb.check_run(['shell', 'chmod', 'a+x', '/data/local/tmp/simpleperf'])
    adb.check_run(['shell', 'rm', '-rf', '/data/local/tmp/perf.data',
                   '/data/local/tmp/simpleperf_output'])
    shell_cmd = 'cd /data/local/tmp && nohup ./simpleperf record ' + args.record_options
    if args.app:
        shell_cmd += ' --app ' + args.app
    if args.size_limit:
        shell_cmd += ' --size-limit ' + args.size_limit
    shell_cmd += ' >/data/local/tmp/simpleperf_output 2>&1'
    print('shell_cmd: %s' % shell_cmd)
    subproc = subprocess.Popen([adb.adb_path, 'shell', shell_cmd])
    # Wait 2 seconds to see if the simpleperf command fails to start.
    time.sleep(2)
    if subproc.poll() is None:
        print('Simpleperf recording has started. Please unplug the usb cable and run the app.')
        print('After that, run `%s stop` to get recording result.' % sys.argv[0])
    else:
        adb.run(['shell', 'cat', '/data/local/tmp/simpleperf_output'])
        sys.exit(subproc.returncode)
Beispiel #5
0
 def download_simpleperf(self):
     simpleperf_binary = get_target_binary_path(self.device_arch,
                                                'simpleperf')
     self.adb.check_run(['push', simpleperf_binary, '/data/local/tmp'])
     self.adb.check_run(
         ['shell', 'chmod', 'a+x', '/data/local/tmp/simpleperf'])
 def download_simpleperf(self):
     simpleperf_binary = get_target_binary_path(self.device_arch, 'simpleperf')
     self.adb.check_run(['push', simpleperf_binary, '/data/local/tmp'])
     self.adb.check_run(['shell', 'chmod', 'a+x', '/data/local/tmp/simpleperf'])
Beispiel #7
0
def upload_simpleperf_to_device(adb):
    device_arch = adb.get_device_arch()
    simpleperf_binary = get_target_binary_path(device_arch, 'simpleperf')
    adb.check_run(['push', simpleperf_binary, '/data/local/tmp'])
    adb.check_run(['shell', 'chmod', 'a+x', '/data/local/tmp/simpleperf'])
def upload_simpleperf_to_device(adb):
    device_arch = adb.get_device_arch()
    simpleperf_binary = get_target_binary_path(device_arch, 'simpleperf')
    adb.check_run(['push', simpleperf_binary, '/data/local/tmp'])
    adb.check_run(['shell', 'chmod', 'a+x', '/data/local/tmp/simpleperf'])