1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-09-02 03:12:34 +01:00

list_or: chaniging how list_or_* functions work and adding a generic list_or

list_or_* functions (e.g. list_or_string) will now always return a list,
however will accept lists or indivitual values. Also added a list_or()
generator function, similar to what already exists for list_of().
This commit is contained in:
Sergei Trofimov
2015-06-01 15:24:22 +01:00
parent a9ab67990a
commit f59da723fb
5 changed files with 73 additions and 50 deletions

View File

@@ -492,19 +492,11 @@ class EnergyModelInstrument(Instrument):
self.big_energy_metrics = []
self.little_energy_metrics = []
if self.power_metric:
if isinstance(self.power_metric, basestring):
self.big_power_metrics = [self.power_metric.format(core=self.big_core)]
self.little_power_metrics = [self.power_metric.format(core=self.little_core)]
else:
self.big_power_metrics = [pm.format(core=self.big_core) for pm in self.power_metric]
self.little_power_metrics = [pm.format(core=self.little_core) for pm in self.power_metric]
self.big_power_metrics = [pm.format(core=self.big_core) for pm in self.power_metric]
self.little_power_metrics = [pm.format(core=self.little_core) for pm in self.power_metric]
else: # must be energy_metric
if isinstance(self.energy_metric, basestring):
self.big_energy_metrics = [self.energy_metric.format(core=self.big_core)]
self.little_energy_metrics = [self.energy_metric.format(core=self.little_core)]
else:
self.big_energy_metrics = [em.format(core=self.big_core) for em in self.energy_metric]
self.little_energy_metrics = [em.format(core=self.little_core) for em in self.energy_metric]
self.big_energy_metrics = [em.format(core=self.big_core) for em in self.energy_metric]
self.little_energy_metrics = [em.format(core=self.little_core) for em in self.energy_metric]
def configure_clusters(self):
self.measured_cores = None

View File

@@ -23,7 +23,7 @@ import itertools
from wlauto import Instrument, Executable, Parameter
from wlauto.exceptions import ConfigError
from wlauto.utils.misc import ensure_file_directory_exists as _f
from wlauto.utils.types import list_or_string, list_of_strs
from wlauto.utils.types import arguments, list_of_strs
PERF_COMMAND_TEMPLATE = '{} stat {} {} sleep 1000 > {} 2>&1 '
@@ -71,7 +71,7 @@ class PerfInstrument(Instrument):
Parameter('events', kind=list_of_strs, default=['migrations', 'cs'],
constraint=(lambda x: x, 'must not be empty.'),
description="""Specifies the events to be counted."""),
Parameter('optionstring', kind=list_or_string, default='-a',
Parameter('optionstring', kind=arguments, default='-a',
description="""Specifies options to be used for the perf command. This
may be a list of option strings, in which case, multiple instances of perf
will be kicked off -- one for each option string. This may be used to e.g.