From 2929106049423125d2a79762bc016ab877169719 Mon Sep 17 00:00:00 2001 From: Vasilis Flouris Date: Wed, 6 May 2015 19:46:20 +0100 Subject: [PATCH] Energy model: fixing sysbench taskset failure Make sure when migrating sshd to root cgroup also migrate their children, including the bash for the wa session. So the subsequent processes kicked off from that shell can be taskset to any cluster. --- wlauto/common/linux/device.py | 2 +- wlauto/instrumentation/energy_model/__init__.py | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/wlauto/common/linux/device.py b/wlauto/common/linux/device.py index 47c952c9..8e81080e 100644 --- a/wlauto/common/linux/device.py +++ b/wlauto/common/linux/device.py @@ -972,7 +972,7 @@ class LinuxDevice(BaseLinuxDevice): # result should be a column of PIDs with the first row as "PID" header result = self.execute('ps -C {} -o pid'.format(process_name), check_exit_code=False).strip().split() if len(result) >= 2: # at least one row besides the header - return result[1:] + return map(int, result[1:]) else: return [] diff --git a/wlauto/instrumentation/energy_model/__init__.py b/wlauto/instrumentation/energy_model/__init__.py index 6ce94740..b4a9fd28 100644 --- a/wlauto/instrumentation/energy_model/__init__.py +++ b/wlauto/instrumentation/energy_model/__init__.py @@ -540,8 +540,12 @@ class EnergyModelInstrument(Instrument): self.cpuset.move_all_tasks_to(self.measuring_cluster) server_process = 'adbd' if self.device.platform == 'android' else 'sshd' server_pids = self.device.get_pids_of(server_process) - self.cpuset.root.add_tasks(server_pids) - for pid in server_pids: + children_ps = [e for e in self.device.ps() + if e.ppid in server_pids and e.name != 'sshd'] + children_pids = [e.pid for e in children_ps] + pids_to_move = server_pids + children_pids + self.cpuset.root.add_tasks(pids_to_move) + for pid in pids_to_move: self.device.execute('busybox taskset -p 0x{:x} {}'.format(list_to_mask(self.measuring_cpus), pid)) def enable_all_cores(self):