diff --git a/libs/wlgen/wlgen/perf_bench.py b/libs/wlgen/wlgen/perf_bench.py index df87bfa6756f9f24718ab893a8b8c1a8daa1df77..02fbf4b8aae7c0db47e255cfebea9b116830ec41 100644 --- a/libs/wlgen/wlgen/perf_bench.py +++ b/libs/wlgen/wlgen/perf_bench.py @@ -35,7 +35,7 @@ class PerfMessaging(Workload): # TODO: Assume perf is pre-installed on target #target.setup('perf') - super(PerfMessaging, self).__init__(target, name, None) + super(PerfMessaging, self).__init__(target, name) # perf "sched" executor self.wtype = 'perf_bench_messaging' @@ -120,7 +120,7 @@ class PerfPipe(Workload): # TODO: Assume perf is pre-installed on target #target.setup('perf') - super(PerfPipe, self).__init__(target, name, None) + super(PerfPipe, self).__init__(target, name) # perf "sched" executor self.wtype = 'perf_bench_pipe' diff --git a/libs/wlgen/wlgen/rta.py b/libs/wlgen/wlgen/rta.py index ceaa8b6fc4937b2108f6add2215dbc8ae1d61368..0f70874badd37101f53be6063b0af7958a47aa01 100644 --- a/libs/wlgen/wlgen/rta.py +++ b/libs/wlgen/wlgen/rta.py @@ -58,7 +58,7 @@ class RTA(Workload): # TODO: Assume rt-app is pre-installed on target # self.target.setup('rt-app') - super(RTA, self).__init__(target, name, calibration) + super(RTA, self).__init__(target, name) # rt-app executor self.wtype = 'rtapp' diff --git a/libs/wlgen/wlgen/workload.py b/libs/wlgen/wlgen/workload.py index 6e65ca9cb1144aa5b799aca9bd3bc374e178bf56..7ea4128e731c923718aee9b831a7ccfe79e8b09f 100644 --- a/libs/wlgen/wlgen/workload.py +++ b/libs/wlgen/wlgen/workload.py @@ -27,8 +27,7 @@ class Workload(object): def __init__(self, target, - name, - calibration=None): + name): # Target device confguration self.target = target @@ -42,23 +41,13 @@ class Workload(object): # The dictionary of tasks descriptors generated by this workload self.tasks = {} - # CPU load calibration values, measured on each core - self.calibration = calibration - # The cpus on which the workload will be executed - # NOTE: for the time being we support just a single CPU self.cpus = None - # The cgroup on which the workload will be executed + # The cgroup on which the workload will be executed # NOTE: requires cgroups to be properly configured and associated # tools deployed on the target self.cgroup = None - self.cgroup_cmd = '' - - # taskset configuration to constraint workload execution on a specified - # set of CPUs - self.taskset = None - self.taskset_cmd = '' # The command to execute a workload (defined by a derived class) self.command = None @@ -137,6 +126,7 @@ class Workload(object): # Initialize run folder if self.run_dir is None: self.run_dir = self.target.working_directory + self.target.execute('mkdir -p {}'.format(self.run_dir)) # Configure a profile workload if kind == 'profile': @@ -214,15 +204,19 @@ class Workload(object): # Prepend eventually required taskset command if cpus or self.cpus: cpus_mask = self.getCpusMask(cpus if cpus else self.cpus) - self.taskset_cmd = '{}/taskset 0x{:X}'\ + taskset_cmd = '{}/taskset 0x{:X}'\ .format(self.target.executables_directory, cpus_mask) _command = '{} {}'\ - .format(self.taskset_cmd, _command) + .format(taskset_cmd, _command) - if self.cgroup and hasattr(self.target, 'cgroups'): - # Get a reference to the CGroup to use - _command = self.target.cgroups.run_into_cmd(self.cgroup, _command) + if self.cgroup: + if hasattr(self.target, 'cgroups'): + _command = self.target.cgroups.run_into_cmd(self.cgroup, + _command) + else: + raise ValueError('To run workload in a cgroup, add "cgroups" ' + 'devlib module to target/test configuration') # Start FTrace (if required) if ftrace: @@ -276,53 +270,6 @@ class Workload(object): def getOutput(self, step='executor'): return self.output[step] - def getTasks(self, dataframe=None, task_names=None, - name_key='comm', pid_key='pid'): - # """ Helper function to get PIDs of specified tasks - # - # This method requires a Pandas dataset in input to be used to - # fiter our the PIDs of all the specified tasks. - # In a dataset is not provided, previouslt filtered PIDs are - # returned. If a list of task names is not provided, the workload - # defined task names is used instead. - # The specified dataframe must provide at least two columns - # reporting the task name and the task PID. The default values of - # this colums could be specified using the provided parameters. - # - # :param task_names: The list of tasks to get the PID of (by default - # the workload defined tasks) - # :param dataframe: A Pandas datafram containing at least 'pid' and - # 'task name' columns - # If None, the previously filtered PIDs are - # returned - # :param name_key: The name of the dataframe columns containing - # task names - # :param pid_key: The name of the dataframe columns containing - # task PIDs - # """ - if dataframe is None: - return self.tasks - if task_names is None: - task_names = self.tasks.keys() - self._log.debug('Lookup dataset for tasks...') - for task_name in task_names: - results = dataframe[dataframe[name_key] == task_name]\ - [[name_key,pid_key]] - if len(results)==0: - self._log.error(' task %16s NOT found', task_name) - continue - (name, pid) = results.head(1).values[0] - if name != task_name: - self._log.error(' task %16s NOT found', task_name) - continue - if task_name not in self.tasks: - self.tasks[task_name] = {} - pids = list(results[pid_key].unique()) - self.tasks[task_name]['pid'] = pids - self._log.info(' task %16s found, pid: %s', - task_name, self.tasks[task_name]['pid']) - return self.tasks - def listAll(self, kill=False): # Show all the instances for the current executor tasks = self.target.run('ps | grep {0:s}'.format(self.executor))