Esempio n. 1
0
def SetupPrebuiltTools(device):
    # TODO(bulach): build the host tools for mac, and the targets for x86/mips.
    # Prebuilt tools from r226197.
    has_prebuilt = sys.platform.startswith('linux')
    if has_prebuilt:
        adb = AdbCommands(device)
        abi = adb.RunShellCommand('getprop ro.product.cpu.abi')
        has_prebuilt = abi and abi[0].startswith('armeabi')
    if not has_prebuilt:
        logging.error('Prebuilt tools only available for ARM.')
        return False

    prebuilt_tools = [
        'forwarder_dist/device_forwarder',
        'host_forwarder',
        'md5sum_dist/md5sum_bin',
        'md5sum_bin_host',
    ]
    for t in prebuilt_tools:
        src = os.path.basename(t)
        android_prebuilt_profiler_helper.GetIfChanged(src)
        dest = os.path.join(constants.GetOutDirectory(), t)
        if not os.path.exists(dest):
            logging.warning('Setting up prebuilt %s', dest)
            if not os.path.exists(os.path.dirname(dest)):
                os.makedirs(os.path.dirname(dest))
            shutil.copyfile(android_prebuilt_profiler_helper.GetHostPath(src),
                            dest)
            os.chmod(dest, stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR)
    return True
Esempio n. 2
0
 def __init__(self, browser_backend, platform_backend, output_path, state):
     super(PerfProfiler, self).__init__(browser_backend, platform_backend,
                                        output_path, state)
     process_output_file_map = self._GetProcessOutputFileMap()
     self._process_profilers = []
     if platform_backend.GetOSName() == 'android':
         android_prebuilt_profiler_helper.GetIfChanged('perfhost')
         os.chmod(android_prebuilt_profiler_helper.GetHostPath('perfhost'),
                  stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR)
         android_prebuilt_profiler_helper.InstallOnDevice(
             browser_backend.adb, 'perf')
     for pid, output_file in process_output_file_map.iteritems():
         if 'zygote' in output_file:
             continue
         self._process_profilers.append(
             _SingleProcessPerfProfiler(pid, output_file, browser_backend,
                                        platform_backend))
Esempio n. 3
0
def SetupPrebuiltTools(adb):
    # TODO(bulach): build the host tools for mac, and the targets for x86/mips.
    # Prebuilt tools from r226197.
    has_prebuilt = sys.platform.startswith('linux')
    if has_prebuilt:
        abi = adb.system_properties['ro.product.cpu.abi']
        has_prebuilt = abi.startswith('armeabi')
    if not has_prebuilt:
        logging.error(
            'Prebuilt android tools only available for Linux host and ARM device.'
        )
        return False

    prebuilt_tools = [
        'bitmaptools',
        'file_poller',
        'forwarder_dist/device_forwarder',
        'host_forwarder',
        'md5sum_dist/md5sum_bin',
        'md5sum_bin_host',
        'purge_ashmem',
    ]
    build_type = None
    for t in prebuilt_tools:
        src = os.path.basename(t)
        android_prebuilt_profiler_helper.GetIfChanged(src)
        bin_path = util.FindSupportBinary(t)
        if not build_type:
            build_type = GetBuildTypeOfPath(bin_path) or 'Release'
            constants.SetBuildType(build_type)
        dest = os.path.join(constants.GetOutDirectory(), t)
        if not bin_path:
            logging.warning('Setting up prebuilt %s', dest)
            if not os.path.exists(os.path.dirname(dest)):
                os.makedirs(os.path.dirname(dest))
            prebuilt_path = android_prebuilt_profiler_helper.GetHostPath(src)
            if not os.path.exists(prebuilt_path):
                raise NotImplementedError("""
%s must be checked into cloud storage.
Instructions:
http://www.chromium.org/developers/telemetry/upload_to_cloud_storage
""" % t)
            shutil.copyfile(prebuilt_path, dest)
            os.chmod(dest, stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR)
    return True