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

energy_model: adding dhrystone support

- updated energy_model to accept dhrystone as well as sysbench as
  the workload
- added "threads" parameter to sysbench (basically, an alias for
  "num_threads") to be consistent with dhrystone
- added "taskset_mask" parameter to dhrystone to allow pinning
  it to specific cores.
This commit is contained in:
Sergei Trofimov 2015-06-11 10:10:36 +01:00
parent 88ba8e3ba7
commit 67896dfd86
3 changed files with 30 additions and 11 deletions

View File

@ -649,8 +649,8 @@ class EnergyModelInstrument(Instrument):
spec.workload.validate()
new_specs.append(spec)
for old_spec in old_specs:
if old_spec.workload_name != 'sysbench':
raise ConfigError('Only sysbench workload currently supported for energy_model generation.')
if old_spec.workload_name in ['sysbench', 'dhrystone']:
raise ConfigError('Only sysbench and dhrystone workloads currently supported for energy_model generation.')
for freq in cluster_frequencies:
for num_cpus in xrange(1, self.number_of_cpus[cluster] + 1):
spec = old_spec.copy()
@ -660,11 +660,12 @@ class EnergyModelInstrument(Instrument):
spec.id = '{}_{}_{}'.format(cluster, num_cpus, freq)
spec.label = 'freq_{}_{}'.format(cluster, spec.label)
spec.workload_parameters['taskset_mask'] = list_to_mask(self.get_cpus(cluster))
spec.workload_parameters['num_threads'] = num_cpus
# max_requests set to an arbitrary high values to make sure
# sysbench runs for full duriation even on highly
# performant cores.
spec.workload_parameters['max_requests'] = 10000000
spec.workload_parameters['threads'] = num_cpus
if old_spec.workload_name == 'sysbench':
# max_requests set to an arbitrary high values to make sure
# sysbench runs for full duriation even on highly
# performant cores.
spec.workload_parameters['max_requests'] = 10000000
spec.cluster = cluster
spec.num_cpus = num_cpus
spec.frequency = freq

View File

@ -59,15 +59,22 @@ class Dhrystone(Workload):
Parameter('delay', kind=int, default=0,
description=('The delay, in seconds, between kicking off of dhrystone '
'threads (if ``threads`` > 1).')),
Parameter('taskset_mask', kind=int, default=0,
description='The processes spawned by sysbench will be pinned to cores as specified by this parameter'),
]
def setup(self, context):
host_exe = os.path.join(this_dir, 'dhrystone')
self.device_exe = self.device.install(host_exe)
execution_mode = '-l {}'.format(self.mloops) if self.mloops else '-r {}'.format(self.duration)
self.command = '{} {} -t {} -d {}'.format(self.device_exe,
execution_mode,
self.threads, self.delay)
if self.taskset_mask:
taskset_string = 'busybox taskset 0x{:x} '.format(self.taskset_mask)
else:
taskset_string = ''
self.command = '{}{} {} -t {} -d {}'.format(taskset_string,
self.device_exe,
execution_mode,
self.threads, self.delay)
self.timeout = self.duration and self.duration + self.delay * self.threads + 10 or 300
def run(self, context):
@ -79,6 +86,8 @@ class Dhrystone(Workload):
wfh.write(self.output)
score_count = 0
dmips_count = 0
total_score = 0
total_dmips = 0
for line in self.output.split('\n'):
match = self.time_regex.search(line)
if match:
@ -90,6 +99,7 @@ class Dhrystone(Workload):
value = int(match.group('score'))
context.result.add_metric(metric, value)
score_count += 1
total_score += value
else:
match = self.dmips_regex.search(line)
if match:
@ -97,6 +107,9 @@ class Dhrystone(Workload):
value = int(match.group('score'))
context.result.add_metric(metric, value)
dmips_count += 1
total_dmips += value
context.result.add_metric('total DMIPS', total_dmips)
context.result.add_metric('total score', total_score)
def teardown(self, context):
self.device.uninstall_executable('dhrystone')

View File

@ -56,8 +56,11 @@ class Sysbench(Workload):
Parameter('test', kind=str, default='cpu',
allowed_values=['fileio', 'cpu', 'memory', 'threads', 'mutex'],
description='sysbench test to run'),
Parameter('num_threads', kind=int, default=8,
Parameter('threads', kind=int, default=8,
description='The number of threads sysbench will launch'),
Parameter('num_threads', kind=int, default=None,
description='The number of threads sysbench will launch, overrides '
' ``threads`` (old parameter name)'),
Parameter('max_requests', kind=int, default=None,
description='The limit for the total number of requests.'),
Parameter('max_time', kind=int, default=None,
@ -78,6 +81,8 @@ class Sysbench(Workload):
]
def validate(self):
if not self.num_threads:
self.num_threads = self.threads
if (self.max_requests is None) and (self.max_time is None):
self.max_time = 30
if self.test == 'fileio' and not self.file_test_mode: