From 5b932a4dcdf7c2c348483d05066a0b796183b52b Mon Sep 17 00:00:00 2001 From: Brendan Jackman Date: Tue, 3 Jan 2017 11:14:46 +0000 Subject: [PATCH 1/8] workload: Formatting --- libs/wlgen/wlgen/workload.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/wlgen/wlgen/workload.py b/libs/wlgen/wlgen/workload.py index 6e65ca9cb..fd3ba20d6 100644 --- a/libs/wlgen/wlgen/workload.py +++ b/libs/wlgen/wlgen/workload.py @@ -49,7 +49,7 @@ class Workload(object): # 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 -- GitLab From 772d394418c0d1ba8beadd22afb8b5d2ba1cb776 Mon Sep 17 00:00:00 2001 From: Brendan Jackman Date: Tue, 3 Jan 2017 11:15:03 +0000 Subject: [PATCH 2/8] workload: Remove taskset instance variables `taskset` isn't used, remove it. `taskset_cmd` is used but overridden, just make it a local variable. --- libs/wlgen/wlgen/workload.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/libs/wlgen/wlgen/workload.py b/libs/wlgen/wlgen/workload.py index fd3ba20d6..0922891e1 100644 --- a/libs/wlgen/wlgen/workload.py +++ b/libs/wlgen/wlgen/workload.py @@ -55,11 +55,6 @@ class Workload(object): 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 @@ -214,11 +209,11 @@ 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 -- GitLab From 1d2337a5c78fd4c8d2488a5c2797674576a9f30c Mon Sep 17 00:00:00 2001 From: Brendan Jackman Date: Tue, 3 Jan 2017 11:20:39 +0000 Subject: [PATCH 3/8] workload: Remove unused cgroup_cmd instance variable --- libs/wlgen/wlgen/workload.py | 1 - 1 file changed, 1 deletion(-) diff --git a/libs/wlgen/wlgen/workload.py b/libs/wlgen/wlgen/workload.py index 0922891e1..7a9d1688e 100644 --- a/libs/wlgen/wlgen/workload.py +++ b/libs/wlgen/wlgen/workload.py @@ -53,7 +53,6 @@ class Workload(object): # NOTE: requires cgroups to be properly configured and associated # tools deployed on the target self.cgroup = None - self.cgroup_cmd = '' # The command to execute a workload (defined by a derived class) self.command = None -- GitLab From 37bf4919c9f2e65459b2819f36ace9054c44ea5c Mon Sep 17 00:00:00 2001 From: Brendan Jackman Date: Tue, 3 Jan 2017 11:27:32 +0000 Subject: [PATCH 4/8] workload: Remove getTasks method This is a method of Trace now --- libs/wlgen/wlgen/workload.py | 47 ------------------------------------ 1 file changed, 47 deletions(-) diff --git a/libs/wlgen/wlgen/workload.py b/libs/wlgen/wlgen/workload.py index 7a9d1688e..ec439e37d 100644 --- a/libs/wlgen/wlgen/workload.py +++ b/libs/wlgen/wlgen/workload.py @@ -270,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)) -- GitLab From 0e6969c856cf0829f1edfe9285c880ecb69ed516 Mon Sep 17 00:00:00 2001 From: Brendan Jackman Date: Tue, 3 Jan 2017 13:32:26 +0000 Subject: [PATCH 5/8] workload: Remove rt-app specific `calibration` --- libs/wlgen/wlgen/perf_bench.py | 4 ++-- libs/wlgen/wlgen/rta.py | 2 +- libs/wlgen/wlgen/workload.py | 6 +----- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/libs/wlgen/wlgen/perf_bench.py b/libs/wlgen/wlgen/perf_bench.py index df87bfa67..02fbf4b8a 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 ceaa8b6fc..0f70874ba 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 ec439e37d..0ae3d0b04 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,9 +41,6 @@ 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 -- GitLab From f84f00d2bece708400d89d631403a492eb6419bc Mon Sep 17 00:00:00 2001 From: Brendan Jackman Date: Fri, 13 Jan 2017 16:18:07 +0000 Subject: [PATCH 6/8] workload: Error if cgroup specified but no cgroups module Instead of failing silently --- libs/wlgen/wlgen/workload.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libs/wlgen/wlgen/workload.py b/libs/wlgen/wlgen/workload.py index 0ae3d0b04..e960a17ce 100644 --- a/libs/wlgen/wlgen/workload.py +++ b/libs/wlgen/wlgen/workload.py @@ -210,9 +210,13 @@ class Workload(object): _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: -- GitLab From d63d3041d52694a4483ad6a531b8879ef61b2be5 Mon Sep 17 00:00:00 2001 From: Brendan Jackman Date: Fri, 13 Jan 2017 16:19:23 +0000 Subject: [PATCH 7/8] workload: Remove outdated comment Multiple values for `cpu` works fine. --- libs/wlgen/wlgen/workload.py | 1 - 1 file changed, 1 deletion(-) diff --git a/libs/wlgen/wlgen/workload.py b/libs/wlgen/wlgen/workload.py index e960a17ce..8383ecc08 100644 --- a/libs/wlgen/wlgen/workload.py +++ b/libs/wlgen/wlgen/workload.py @@ -42,7 +42,6 @@ class Workload(object): self.tasks = {} # 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 -- GitLab From 38a4745d57e24dd9f5f8e067d908cb8b43aff6ad Mon Sep 17 00:00:00 2001 From: Brendan Jackman Date: Tue, 31 Jan 2017 19:24:43 +0000 Subject: [PATCH 8/8] workload: Create run_dir in conf method RTA assumes that run_dir already exists - if it doesn't then it will create run_dir as a file containing its config JSON. It seems reasonable that all workloads could expect the run_dir to exist so create it in the base class. --- libs/wlgen/wlgen/workload.py | 1 + 1 file changed, 1 insertion(+) diff --git a/libs/wlgen/wlgen/workload.py b/libs/wlgen/wlgen/workload.py index 8383ecc08..7ea4128e7 100644 --- a/libs/wlgen/wlgen/workload.py +++ b/libs/wlgen/wlgen/workload.py @@ -126,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': -- GitLab