1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-01-31 02:00:45 +00:00

Merge pull request #57 from derkling/cgroups-cosmetics

Cgroups cosmetics
This commit is contained in:
setrofim 2016-08-31 11:53:19 +01:00 committed by GitHub
commit 0e8fc0d732

View File

@ -150,16 +150,16 @@ class Controller(object):
raise ValueError('wrong type for "exclude" parameter, '
'it must be a str or a list')
logging.info('Moving all tasks into %s', dest)
logging.debug('Moving all tasks into %s', dest)
# Build list of tasks to exclude
grep_filters = ''
for comm in exclude:
grep_filters += '-e "{}" '.format(comm)
logging.debug('Using grep filter: %s', grep_filters)
logging.debug(' using grep filter: %s', grep_filters)
if grep_filters != '':
logging.info('Excluding tasks which name matches:')
logging.info('%s', ','.join(exclude))
logging.debug(' excluding tasks which name matches:')
logging.debug(' %s', ', '.join(exclude))
for cgroup in self._cgroups:
if cgroup != dest:
@ -425,7 +425,7 @@ class CgroupsModule(Module):
def freeze(self, exclude=[], thaw=False):
"""
Freeze all tasks while keeping a live console
Freeze all user-space tasks but the specified ones
A freezer cgroup is used to stop all the tasks in the target system but
the ones which name match one of the path specified by the exclude
@ -435,7 +435,10 @@ class CgroupsModule(Module):
the PID of these tasks.
:param exclude: list of commands paths to exclude from freezer
:type exlude: list(str)
:type exclude: list(str)
:param thaw: if true thaw tasks instead
:type thaw: bool
"""
# Create Freezer CGroup
@ -453,11 +456,11 @@ class CgroupsModule(Module):
# Move all tasks into the freezer group
freezer.move_all_tasks_to('/DEVLIB_FREEZER', exclude)
logging.info("Non freezable tasks:")
# Get list of not frozen tasks, which is reported as output
tasks = freezer.tasks('/')
for tid in tasks:
logging.info("%5d: %s", tid, tasks[tid])
# Freeze all tasks
freezer_cg.set(state='FROZEN')
return tasks