mirror of
				https://github.com/ARM-software/workload-automation.git
				synced 2025-10-29 22:24:51 +00:00 
			
		
		
		
	| @@ -80,8 +80,8 @@ class GlobalParameterAlias(object): | ||||
|                     other_param.kind != param.kind): | ||||
|                 message = 'Duplicate global alias {} declared in {} and {} extensions with different types' | ||||
|                 raise LoaderError(message.format(self.name, ext.name, other_ext.name)) | ||||
|             if param.name != other_param.name: | ||||
|                 message = 'Two params {} in {} and {} in {} both declare global alias {}' | ||||
|             if param.kind != other_param.kind: | ||||
|                 message = 'Two params {} in {} and {} in {} both declare global alias {}, and are of different kinds' | ||||
|                 raise LoaderError(message.format(param.name, ext.name, | ||||
|                                                  other_param.name, other_ext.name, self.name)) | ||||
|  | ||||
|   | ||||
| @@ -180,17 +180,15 @@ class DependencyFileGetter(ResourceGetter): | ||||
|     resource_type = 'file' | ||||
|     relative_path = ''  # May be overridden by subclasses. | ||||
|  | ||||
|     default_mount_point = '/' | ||||
|     priority = GetterPriority.remote | ||||
|  | ||||
|     parameters = [ | ||||
|         Parameter('mount_point', default='/', global_alias='filer_mount_point', | ||||
|         Parameter('mount_point', default='/', global_alias='remote_assets_path', | ||||
|                   description='Local mount point for the remote filer.'), | ||||
|     ] | ||||
|  | ||||
|     def __init__(self, resolver, **kwargs): | ||||
|         super(DependencyFileGetter, self).__init__(resolver, **kwargs) | ||||
|         self.mount_point = settings.filer_mount_point or self.default_mount_point | ||||
|  | ||||
|     def get(self, resource, **kwargs): | ||||
|         force = kwargs.get('force') | ||||
| @@ -260,7 +258,6 @@ class ExtensionAssetGetter(DependencyFileGetter): | ||||
|  | ||||
|     name = 'extension_asset' | ||||
|     resource_type = 'extension_asset' | ||||
|     relative_path = 'workload_automation/assets' | ||||
|  | ||||
|  | ||||
| class HttpGetter(ResourceGetter): | ||||
|   | ||||
| @@ -41,7 +41,7 @@ class ApkLaunchWorkload(Workload): | ||||
|  | ||||
|     def setup(self, context): | ||||
|         apk_file = context.resolver.get(File(self, self.apk_file)) | ||||
|         self.package = ApkInfo(apk_file).package | ||||
|         self.package = ApkInfo(apk_file).package  # pylint: disable=attribute-defined-outside-init | ||||
|  | ||||
|         self.logger.info('Installing {}'.format(apk_file)) | ||||
|         return self.device.install(apk_file) | ||||
|   | ||||
| @@ -138,19 +138,7 @@ class ApplaunchWorkload(Workload): | ||||
|                 scheduler_used = scheduler[scheduler.index("[") + 1:scheduler.index("]")] | ||||
|                 metric_suffix = '_' + scheduler_used | ||||
|         for filename in result_files: | ||||
|             host_result_file = os.path.join(context.output_directory, filename) | ||||
|             device_result_file = self.device.path.join(self.device.working_directory, filename) | ||||
|             self.device.pull_file(device_result_file, host_result_file) | ||||
|  | ||||
|             with open(host_result_file) as fh: | ||||
|                 if filename == 'time.result': | ||||
|                     values = [v / 1000 for v in map(int, fh.read().split())] | ||||
|                     _add_metric(context, 'time' + metric_suffix, values, 'Seconds') | ||||
|                 else: | ||||
|                     metric = filename.replace('.result', '').lower() | ||||
|                     numbers = iter(map(int, fh.read().split())) | ||||
|                     deltas = [(after - before) / 1000000 for before, after in zip(numbers, numbers)] | ||||
|                     _add_metric(context, metric, deltas, 'Joules') | ||||
|             self._extract_results_from_file(context, filename, metric_suffix) | ||||
|  | ||||
|     def teardown(self, context): | ||||
|         if self.set_launcher_affinity: | ||||
| @@ -178,6 +166,21 @@ class ApplaunchWorkload(Workload): | ||||
|         command = 'taskset -p 0x{:X} {}'.format(self._old_launcher_affinity, self._launcher_pid) | ||||
|         self.device.execute(command, busybox=True, as_root=True) | ||||
|  | ||||
|     def _extract_results_from_file(self, context, filename, metric_suffix): | ||||
|         host_result_file = os.path.join(context.output_directory, filename) | ||||
|         device_result_file = self.device.path.join(self.device.working_directory, filename) | ||||
|         self.device.pull_file(device_result_file, host_result_file) | ||||
|  | ||||
|         with open(host_result_file) as fh: | ||||
|             if filename == 'time.result': | ||||
|                 values = [v / 1000 for v in map(int, fh.read().split())] | ||||
|                 _add_metric(context, 'time' + metric_suffix, values, 'Seconds') | ||||
|             else: | ||||
|                 metric = filename.replace('.result', '').lower() | ||||
|                 numbers = iter(map(int, fh.read().split())) | ||||
|                 deltas = [(after - before) / 1000000 for before, after in zip(numbers, numbers)] | ||||
|                 _add_metric(context, metric, deltas, 'Joules') | ||||
|  | ||||
|  | ||||
| def _add_metric(context, metric, values, units): | ||||
|     mean, sd = get_meansd(values) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user