def initialize(self, context): Stream.stream_noomp_binary = context.resolver.get( Executable(self, self.device.abi, 'stream_noomp')) Stream.stream_omp_binary = context.resolver.get( Executable(self, self.device.abi, 'stream_omp')) Stream.stream_default = self.device.install(Stream.stream_noomp_binary) Stream.stream_optional = self.device.install(Stream.stream_omp_binary)
def setup(self, context): self.cyclictest_on_device = 'cyclictest' self.cyclictest_result = os.path.join(self.device.working_directory, TXT_RESULT_NAME) self.cyclictest_command = '{} --clock={} --duration={}s --thread={} --latency={} {} {} > {}' self.device_binary = None if not self.device.is_rooted: raise WorkloadError( "This workload requires a device with root premissions to run") host_binary = context.resolver.get( Executable(self, self.device.abi, 'cyclictest')) self.device_binary = self.device.install(host_binary) self.cyclictest_command = self.cyclictest_command.format( self.device_binary, 0 if self.clock == 'monotonic' else 1, self.duration, self.thread, self.latency, "--quiet" if self.quiet else "", self.extra_parameters, self.cyclictest_result) if self.clear_file_cache: self.device.execute('sync') self.device.set_sysfile_value('/proc/sys/vm/drop_caches', 3) if self.device.platform == 'android': if self.screen_off and self.device.is_screen_on: self.device.execute('input keyevent 26')
def initialize(self, context): if not self.device.is_rooted and self.as_root: raise ConfigError('The device is not rooted, cannot run poller as root.') host_poller = context.resolver.get(Executable(self, self.device.abi, "poller")) target_poller = self.device.install(host_poller) expanded_paths = [] for path in self.files: if "*" in path: for p in self.device.listdir(path): expanded_paths.append(p) else: expanded_paths.append(path) self.files = expanded_paths if not self.labels: self.labels = self._generate_labels() self.target_output_path = self.device.path.join(self.device.working_directory, 'poller.csv') self.target_log_path = self.device.path.join(self.device.working_directory, 'poller.log') self.command = '{} -t {} -l {} {} > {} 2>{}'.format(target_poller, self.sample_interval * 1000, ','.join(self.labels), ' '.join(self.files), self.target_output_path, self.target_log_path)
def on_run_init(self, context): if not self.device.is_installed('perf') or self.force_install: binary = context.resolver.get( Executable(self, self.device.abi, 'perf')) self.binary = self.device.install(binary) else: self.binary = 'perf' self.commands = self._build_commands()
def on_run_init(self, context): binary = context.resolver.get(Executable(self, self.device.abi, 'perf')) if self.force_install: self.binary = self.device.install(binary) else: self.binary = self.device.install_if_needed(binary) self.commands = self._build_commands()
def setup(self, context): self.binary_name = 'memcpy' host_binary = context.resolver.get( Executable(self, self.device.abi, self.binary_name)) self.device_binary = self.device.install_if_needed(host_binary) self.command = '{} -i {} -s {}'.format(self.device_binary, self.iterations, self.buffer_size) if self.cpus: for c in self.cpus: self.command += ' -c {}'.format(c)
def initialize(self, context): # pylint: disable=no-self-use assets_dir = self.device.path.join(self.device.working_directory, 'assets') self.device.execute('mkdir -p {}'.format(assets_dir)) assets_tar = 'octaned8-assets.tar' fpath = context.resolver.get(File(self, assets_tar)) self.device.push_file(fpath, assets_dir, timeout=300) self.command = 'cd {}; {} busybox tar -x -f {}'.format(assets_dir, self.device.busybox, assets_tar) self.output = self.device.execute(self.command, timeout=self.run_timeout) for f in self.executables: binFile = context.resolver.get(Executable(self, self.device.abi, f)) self.device_exe = self.device.install(binFile)
def setup(self, context): host_binary = context.resolver.get( Executable(self, self.device.abi, 'stress-ng')) self.binary = self.device.install_if_needed(host_binary) self.log = self.device.path.join(self.device.working_directory, 'stress_ng_output.txt') self.results = self.device.path.join(self.device.working_directory, 'stress_ng_results.yaml') self.command = ('{} --{} {} --timeout {}s --log-file {} --yaml {} ' '--metrics-brief --verbose'.format( self.binary, self.stressor, self.threads, self.duration, self.log, self.results)) self.timeout = self.duration + 10
def setup(self, context): abi = self.device.abi if self.force_abi: abi = self.force_abi # self.test has been pre-validated, so this _should_ only fail if there's an abi mismatch host_exe = context.resolver.get(Executable(self, abi, self.test)) self.device_exe = self.device.install(host_exe) self.commands = [] setup_test = getattr(self, '_setup_{}'.format(self.test)) setup_test()
def initialize(self, context): # initialize() runs once per run. setting a class variable to make it # available to other instances of the workload RtApp.device_working_directory = self.device.path.join(self.device.working_directory, 'rt-app-working') RtApp.host_binary = context.resolver.get(Executable(self, self.device.abi, BINARY_NAME), strict=False) RtApp.workgen_script = context.resolver.get(File(self, 'workgen')) if not self.device.is_rooted: # some use cases require root privileges raise WorkloadError('rt-app requires the device to be rooted.') self.device.execute('mkdir -p {}'.format(self.device_working_directory)) self._deploy_rt_app_binary_if_necessary()
def setup(self, context): host_binary = context.resolver.get( Executable(self, self.device.abi, 'blogbench')) self.binary = self.device.install_if_needed(host_binary) # Total test duration equal to iteration*frequency # The default frequency is 10 seconds, plus 5 here as a buffer. self.timeout = self.iterations * 15 # An empty and writable directory is needed. self.directory = self.device.path.join(self.device.working_directory, 'blogbench') self.device.execute('rm -rf {}'.format(self.directory), timeout=300) self.device.execute('mkdir -p {}'.format(self.directory)) self.results = self.device.path.join(self.device.working_directory, 'blogbench.output') self.command = ('{} --iterations {} --directory {} > {}'.format( self.binary, self.iterations, self.directory, self.results))
def setup(self, context): timeout_buf = 10 self.command = '{} -t {} -S {} -n {} {} > {}' self.ebizzy_results = self.device.path.join( self.device.working_directory, results_txt) self.device_binary = None self.run_timeout = self.seconds + timeout_buf self.binary_name = 'ebizzy' host_binary = context.resolver.get( Executable(self, self.device.abi, self.binary_name)) self.device_binary = self.device.install_if_needed(host_binary) self.command = self.command.format(self.device_binary, self.threads, self.seconds, self.chunks, self.extra_params, self.ebizzy_results)
def setup(self, context): timeout_buf = 10 self.command = '{} -s {} -g {} -l {} {} > {}' self.device_binary = None self.hackbench_result = os.path.join(self.device.working_directory, hackbench_results_txt) self.run_timeout = self.duration + timeout_buf self.binary_name = 'hackbench' host_binary = context.resolver.get( Executable(self, self.device.abi, self.binary_name)) self.device_binary = self.device.install(host_binary) self.command = self.command.format(self.device_binary, self.datasize, self.groups, self.loops, self.extra_params, self.hackbench_result)
def setup(self, context): host_exe = context.resolver.get( Executable(self, self.device.abi, 'dhrystone')) self.device_exe = self.device.install(host_exe) execution_mode = '-l {}'.format( self.mloops) if self.mloops else '-r {}'.format(self.duration) if self.taskset_mask: taskset_string = '{} taskset 0x{:x} '.format( self.device.busybox, self.taskset_mask) else: taskset_string = '' self.command = '{}{} {} -t {} -d {}'.format(taskset_string, self.device_exe, execution_mode, self.threads, self.delay) self.timeout = self.duration and self.duration + self.delay * self.threads + 10 or 300 self.device.killall('dhrystone')
def on_run_init(self, context): if not self.device.is_rooted: raise InstrumentError( 'trace-cmd instrument cannot be used on an unrooted device.') if not self.no_install: host_file = context.resolver.get( Executable(self, self.device.abi, 'trace-cmd')) self.trace_cmd = self.device.install_executable(host_file) else: if not self.device.is_installed('trace-cmd'): raise ConfigError( 'No trace-cmd found on device and no_install=True is specified.' ) self.trace_cmd = 'trace-cmd' # Register ourselves as absolute last event before and # first after so we can mark the trace at the right time signal.connect(self.insert_start_mark, signal.BEFORE_WORKLOAD_EXECUTION, priority=11) signal.connect(self.insert_end_mark, signal.AFTER_WORKLOAD_EXECUTION, priority=11)
def setup(self, context): host_exe = context.resolver.get( Executable(self, self.device.abi, BINARY)) self.target_exe = self.device.install(host_exe)
def initialize(self, context): host_exe = context.resolver.get( Executable(self, self.device.abi, 'linpack')) LinpackCliWorkload.binary = self.device.install(host_exe)
def init_resources(self, context): self.on_host_binary = context.resolver.get(Executable( self, 'armeabi', 'sysbench'), strict=False)
def initialize(self, context): Iozone.host_binary = context.resolver.get( Executable(self, self.device.abi, 'iozone')) Iozone.device_binary = self.device.install(Iozone.host_binary)
def setup(self, context): # NOQA self.bbench_on_device = '/'.join( [self.device.working_directory, 'bbench']) self.bbench_server_on_device = os.path.join( self.device.working_directory, BBENCH_SERVER_NAME) self.audio_on_device = os.path.join(self.device.working_directory, DEFAULT_AUDIO_FILE_NAME) self.index_noinput = 'file:///{}'.format( self.bbench_on_device) + '/index_noinput.html' if not os.path.isdir(os.path.join(self.dependencies_directory, "sites")): self._download_bbench_file() if self.with_audio and not os.path.isfile(self.audio_file): self._download_audio_file() if not os.path.isdir(self.dependencies_directory): raise ConfigError('Bbench directory does not exist: {}'.format( self.dependencies_directory)) self._apply_patches() if self.with_audio: if self.force_dependency_push or not self.device.file_exists( self.audio_on_device): self.device.push_file(self.audio_file, self.audio_on_device, timeout=120) # Push the bbench site pages and http server to target device if self.force_dependency_push or not self.device.file_exists( self.bbench_on_device): self.logger.debug('Copying bbench sites to device.') self.device.push_file(self.dependencies_directory, self.bbench_on_device, timeout=300) # Push the bbench server host_binary = context.resolver.get( Executable(self, self.device.abi, 'bbench_server')) device_binary = self.device.install(host_binary) self.luanch_server_command = '{} {}'.format(device_binary, self.server_timeout) # Open the browser with default page self.device.execute('am start -n {}/{} about:blank'.format( self.browser_package, self.browser_activity)) time.sleep(5) # Stop the browser if already running and wait for it to stop self.device.execute('am force-stop {}'.format(self.browser_package)) time.sleep(5) # Clear the logs self.device.clear_logcat() # clear browser cache self.device.execute('pm clear {}'.format(self.browser_package)) if self.clear_file_cache: self.device.execute('sync') self.device.set_sysfile_value('/proc/sys/vm/drop_caches', 3) #On android 6+ the web browser requires permissions to access the sd card if self.device.get_sdk_version() >= 23: self.device.execute( "pm grant {} android.permission.READ_EXTERNAL_STORAGE".format( self.browser_package)) self.device.execute( "pm grant {} android.permission.WRITE_EXTERNAL_STORAGE".format( self.browser_package)) # Launch the background music if self.with_audio: self.device.execute( 'am start -W -S -n com.android.music/.MediaPlaybackActivity -d {}' .format(self.audio_on_device))