mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-01-31 10:11:17 +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:
parent
88ba8e3ba7
commit
67896dfd86
@ -649,8 +649,8 @@ class EnergyModelInstrument(Instrument):
|
|||||||
spec.workload.validate()
|
spec.workload.validate()
|
||||||
new_specs.append(spec)
|
new_specs.append(spec)
|
||||||
for old_spec in old_specs:
|
for old_spec in old_specs:
|
||||||
if old_spec.workload_name != 'sysbench':
|
if old_spec.workload_name in ['sysbench', 'dhrystone']:
|
||||||
raise ConfigError('Only sysbench workload currently supported for energy_model generation.')
|
raise ConfigError('Only sysbench and dhrystone workloads currently supported for energy_model generation.')
|
||||||
for freq in cluster_frequencies:
|
for freq in cluster_frequencies:
|
||||||
for num_cpus in xrange(1, self.number_of_cpus[cluster] + 1):
|
for num_cpus in xrange(1, self.number_of_cpus[cluster] + 1):
|
||||||
spec = old_spec.copy()
|
spec = old_spec.copy()
|
||||||
@ -660,7 +660,8 @@ class EnergyModelInstrument(Instrument):
|
|||||||
spec.id = '{}_{}_{}'.format(cluster, num_cpus, freq)
|
spec.id = '{}_{}_{}'.format(cluster, num_cpus, freq)
|
||||||
spec.label = 'freq_{}_{}'.format(cluster, spec.label)
|
spec.label = 'freq_{}_{}'.format(cluster, spec.label)
|
||||||
spec.workload_parameters['taskset_mask'] = list_to_mask(self.get_cpus(cluster))
|
spec.workload_parameters['taskset_mask'] = list_to_mask(self.get_cpus(cluster))
|
||||||
spec.workload_parameters['num_threads'] = num_cpus
|
spec.workload_parameters['threads'] = num_cpus
|
||||||
|
if old_spec.workload_name == 'sysbench':
|
||||||
# max_requests set to an arbitrary high values to make sure
|
# max_requests set to an arbitrary high values to make sure
|
||||||
# sysbench runs for full duriation even on highly
|
# sysbench runs for full duriation even on highly
|
||||||
# performant cores.
|
# performant cores.
|
||||||
|
@ -59,13 +59,20 @@ class Dhrystone(Workload):
|
|||||||
Parameter('delay', kind=int, default=0,
|
Parameter('delay', kind=int, default=0,
|
||||||
description=('The delay, in seconds, between kicking off of dhrystone '
|
description=('The delay, in seconds, between kicking off of dhrystone '
|
||||||
'threads (if ``threads`` > 1).')),
|
'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):
|
def setup(self, context):
|
||||||
host_exe = os.path.join(this_dir, 'dhrystone')
|
host_exe = os.path.join(this_dir, 'dhrystone')
|
||||||
self.device_exe = self.device.install(host_exe)
|
self.device_exe = self.device.install(host_exe)
|
||||||
execution_mode = '-l {}'.format(self.mloops) if self.mloops else '-r {}'.format(self.duration)
|
execution_mode = '-l {}'.format(self.mloops) if self.mloops else '-r {}'.format(self.duration)
|
||||||
self.command = '{} {} -t {} -d {}'.format(self.device_exe,
|
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,
|
execution_mode,
|
||||||
self.threads, self.delay)
|
self.threads, self.delay)
|
||||||
self.timeout = self.duration and self.duration + self.delay * self.threads + 10 or 300
|
self.timeout = self.duration and self.duration + self.delay * self.threads + 10 or 300
|
||||||
@ -79,6 +86,8 @@ class Dhrystone(Workload):
|
|||||||
wfh.write(self.output)
|
wfh.write(self.output)
|
||||||
score_count = 0
|
score_count = 0
|
||||||
dmips_count = 0
|
dmips_count = 0
|
||||||
|
total_score = 0
|
||||||
|
total_dmips = 0
|
||||||
for line in self.output.split('\n'):
|
for line in self.output.split('\n'):
|
||||||
match = self.time_regex.search(line)
|
match = self.time_regex.search(line)
|
||||||
if match:
|
if match:
|
||||||
@ -90,6 +99,7 @@ class Dhrystone(Workload):
|
|||||||
value = int(match.group('score'))
|
value = int(match.group('score'))
|
||||||
context.result.add_metric(metric, value)
|
context.result.add_metric(metric, value)
|
||||||
score_count += 1
|
score_count += 1
|
||||||
|
total_score += value
|
||||||
else:
|
else:
|
||||||
match = self.dmips_regex.search(line)
|
match = self.dmips_regex.search(line)
|
||||||
if match:
|
if match:
|
||||||
@ -97,6 +107,9 @@ class Dhrystone(Workload):
|
|||||||
value = int(match.group('score'))
|
value = int(match.group('score'))
|
||||||
context.result.add_metric(metric, value)
|
context.result.add_metric(metric, value)
|
||||||
dmips_count += 1
|
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):
|
def teardown(self, context):
|
||||||
self.device.uninstall_executable('dhrystone')
|
self.device.uninstall_executable('dhrystone')
|
||||||
|
@ -56,8 +56,11 @@ class Sysbench(Workload):
|
|||||||
Parameter('test', kind=str, default='cpu',
|
Parameter('test', kind=str, default='cpu',
|
||||||
allowed_values=['fileio', 'cpu', 'memory', 'threads', 'mutex'],
|
allowed_values=['fileio', 'cpu', 'memory', 'threads', 'mutex'],
|
||||||
description='sysbench test to run'),
|
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'),
|
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,
|
Parameter('max_requests', kind=int, default=None,
|
||||||
description='The limit for the total number of requests.'),
|
description='The limit for the total number of requests.'),
|
||||||
Parameter('max_time', kind=int, default=None,
|
Parameter('max_time', kind=int, default=None,
|
||||||
@ -78,6 +81,8 @@ class Sysbench(Workload):
|
|||||||
]
|
]
|
||||||
|
|
||||||
def validate(self):
|
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):
|
if (self.max_requests is None) and (self.max_time is None):
|
||||||
self.max_time = 30
|
self.max_time = 30
|
||||||
if self.test == 'fileio' and not self.file_test_mode:
|
if self.test == 'fileio' and not self.file_test_mode:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user