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 = [] self._perf_control = None perf_binary = perfhost_binary = _InstallPerfHost() try: if platform_backend.GetOSName() == 'android': device = browser_backend.adb.device() perf_binary = android_profiling_helper.PrepareDeviceForPerf( device) self._perf_control = perf_control.PerfControl(device) self._perf_control.SetPerfProfilingMode() else: _PrepareHostForPerf() 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, perf_binary, perfhost_binary)) except: if self._perf_control: self._perf_control.SetDefaultPerfMode() raise
def _PrepareDevice(device): if not 'BUILDTYPE' in os.environ: os.environ['BUILDTYPE'] = 'Release' return android_profiling_helper.PrepareDeviceForPerf(device)