1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-10-29 22:24:51 +00:00

wa/workloads: Update to use new cpu_mask type

Update workloads that allow for specifying which cpus to be ran on to
all use the same interface while maintaining backwards compatibility with
the existing configuration options.
This commit is contained in:
Marc Bonnici
2018-05-11 13:40:40 +01:00
committed by setrofim
parent 670fe6fb83
commit 8d7d32d180
4 changed files with 26 additions and 21 deletions

View File

@@ -20,7 +20,7 @@ import os
from wa import Workload, Parameter, Executable, WorkloadError, ConfigError
from wa.utils.exec_control import once
from wa.utils.misc import parse_value
from wa.utils.types import numeric
from wa.utils.types import numeric, cpu_mask
class Sysbench(Workload):
@@ -84,10 +84,11 @@ class Sysbench(Workload):
Additional parameters to be passed to sysbench as a single
string.
'''),
Parameter('taskset_mask', kind=int, default=0,
Parameter('cpus', kind=cpu_mask, default=0, aliases=['taskset_mask'],
description='''
The processes spawned by sysbench will be pinned to cores as
specified by this parameter.
The processes spawned by sysbench will be
pinned to cores as specified by this parameter. Can be
provided as a mask, a list of cpus or a sysfs-style string.
'''),
]
@@ -158,8 +159,8 @@ class Sysbench(Workload):
if self.file_test_mode:
param_strings.append('--file-test-mode={}'.format(self.file_test_mode))
sysbench_command = '{} {} {} run'.format(self.target_binary, ' '.join(param_strings), self.cmd_params)
if self.taskset_mask:
taskset_string = '{} taskset 0x{:x} '.format(self.target.busybox, self.taskset_mask)
if self.cpus:
taskset_string = '{} taskset {} '.format(self.target.busybox, self.cpus.mask())
else:
taskset_string = ''
return 'cd {} && {} {} > sysbench_result.txt'.format(self.target.working_directory, taskset_string, sysbench_command)