mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-04-20 09:40:50 +01:00
dhrystone tidy
This commit is contained in:
parent
24402660c4
commit
4287e90153
@ -47,19 +47,31 @@ class Dhrystone(Workload):
|
|||||||
|
|
||||||
parameters = [
|
parameters = [
|
||||||
Parameter('duration', kind=int, default=0,
|
Parameter('duration', kind=int, default=0,
|
||||||
description='The duration, in seconds, for which dhrystone will be executed. '
|
description='''
|
||||||
'Either this or ``mloops`` should be specified but not both.'),
|
The duration, in seconds, for which dhrystone will be
|
||||||
|
executed. Either this or ``mloops`` should be specified but
|
||||||
|
not both.
|
||||||
|
'''),
|
||||||
Parameter('mloops', kind=int, default=0,
|
Parameter('mloops', kind=int, default=0,
|
||||||
description='Millions of loops to run. Either this or ``duration`` should be '
|
description='''
|
||||||
'specified, but not both. If neither is specified, this will default '
|
Millions of loops to run. Either this or ``duration`` should
|
||||||
'to ``{}``'.format(default_mloops)),
|
be specified, but not both. If neither is specified, this
|
||||||
|
will default ' to ``{}``
|
||||||
|
'''.format(default_mloops)),
|
||||||
Parameter('threads', kind=int, default=4,
|
Parameter('threads', kind=int, default=4,
|
||||||
description='The number of separate dhrystone "threads" that will be forked.'),
|
description='''
|
||||||
|
The number of separate dhrystone "threads" that will be forked.
|
||||||
|
'''),
|
||||||
Parameter('delay', kind=int, default=0,
|
Parameter('delay', kind=int, default=0,
|
||||||
description=('The delay, in seconds, between kicking off of dhrystone '
|
description=('''
|
||||||
'threads (if ``threads`` > 1).')),
|
The delay, in seconds, between kicking off of dhrystone
|
||||||
|
threads (if ``threads`` > 1).
|
||||||
|
''')),
|
||||||
Parameter('taskset_mask', kind=int, default=0,
|
Parameter('taskset_mask', kind=int, default=0,
|
||||||
description='The processes spawned by sysbench will be pinned to cores as specified by this parameter'),
|
description='''
|
||||||
|
The processes spawned by sysbench will be pinned to cores as
|
||||||
|
specified by this parameter.
|
||||||
|
'''),
|
||||||
]
|
]
|
||||||
|
|
||||||
def initialize(self, context):
|
def initialize(self, context):
|
||||||
@ -67,7 +79,10 @@ class Dhrystone(Workload):
|
|||||||
Dhrystone.target_exe = self.target.install(host_exe)
|
Dhrystone.target_exe = self.target.install(host_exe)
|
||||||
|
|
||||||
def setup(self, context):
|
def setup(self, context):
|
||||||
execution_mode = '-l {}'.format(self.mloops) if self.mloops else '-r {}'.format(self.duration)
|
if self.mloops:
|
||||||
|
execution_mode = '-l {}'.format(self.mloops)
|
||||||
|
else:
|
||||||
|
execution_mode = '-r {}'.format(self.duration)
|
||||||
if self.taskset_mask:
|
if self.taskset_mask:
|
||||||
taskset_string = 'busybox taskset 0x{:x} '.format(self.taskset_mask)
|
taskset_string = 'busybox taskset 0x{:x} '.format(self.taskset_mask)
|
||||||
else:
|
else:
|
||||||
@ -76,12 +91,18 @@ class Dhrystone(Workload):
|
|||||||
self.target_exe,
|
self.target_exe,
|
||||||
execution_mode,
|
execution_mode,
|
||||||
self.threads, self.delay)
|
self.threads, self.delay)
|
||||||
self.timeout = self.duration and self.duration + self.delay * self.threads + 10 or 300
|
if self.duration:
|
||||||
|
self.timeout = self.duration + self.delay * self.threads + 10
|
||||||
|
else:
|
||||||
|
self.timeout = 300
|
||||||
|
|
||||||
self.target.killall('dhrystone')
|
self.target.killall('dhrystone')
|
||||||
|
|
||||||
def run(self, context):
|
def run(self, context):
|
||||||
try:
|
try:
|
||||||
self.output = self.target.execute(self.command, timeout=self.timeout, check_exit_code=False)
|
self.output = self.target.execute(self.command,
|
||||||
|
timeout=self.timeout,
|
||||||
|
check_exit_code=False)
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
self.target.killall('dhrystone')
|
self.target.killall('dhrystone')
|
||||||
raise
|
raise
|
||||||
@ -127,7 +148,9 @@ class Dhrystone(Workload):
|
|||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
if self.mloops and self.duration: # pylint: disable=E0203
|
if self.mloops and self.duration: # pylint: disable=E0203
|
||||||
raise ConfigError('mloops and duration cannot be both specified at the same time for dhrystone.')
|
msg = 'mloops and duration cannot be both specified at the '\
|
||||||
|
'same time for dhrystone.'
|
||||||
|
raise ConfigError(msg)
|
||||||
if not self.mloops and not self.duration: # pylint: disable=E0203
|
if not self.mloops and not self.duration: # pylint: disable=E0203
|
||||||
self.mloops = self.default_mloops
|
self.mloops = self.default_mloops
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user