1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2024-10-06 02:41:11 +01:00

device: set core_clusters from core_names if not explicitly specified

if core_names are specified in the device config but core_clusters are
not, assume that all cores with the same name are on the same cluster.
This commit is contained in:
Sergei Trofimov 2015-06-16 12:21:44 +01:00
parent 15e854b8f1
commit 53de517488
2 changed files with 15 additions and 3 deletions

View File

@ -175,8 +175,6 @@ class BaseLinuxDevice(Device): # pylint: disable=abstract-method
self._abi = None
def validate(self):
if len(self.core_names) != len(self.core_clusters):
raise ConfigError('core_names and core_clusters are of different lengths.')
if self.iks_switch_frequency is not None and self.scheduler != 'iks': # pylint: disable=E0203
raise ConfigError('iks_switch_frequency must NOT be set for non-IKS devices.')
if self.iks_switch_frequency is None and self.scheduler == 'iks': # pylint: disable=E0203

View File

@ -150,7 +150,9 @@ class Device(Extension):
This is a list indicating the cluster affinity of the CPU cores,
each element correponding to the cluster ID of the core coresponding
to it's index. E.g. ``[0, 0, 1]`` indicates that cpu0 and cpu1 are on
cluster 0, while cpu2 is on cluster 1.
cluster 0, while cpu2 is on cluster 1. If this is not specified, this
will be inferred from ``core_names`` if possible (assuming all cores with
the same name are on the same cluster).
"""),
]
@ -177,6 +179,18 @@ class Device(Extension):
except IOError:
raise DeviceError('Unsupported path module: {}'.format(self.path_module))
def validate(self):
# pylint: disable=access-member-before-definition,attribute-defined-outside-init
if self.core_names and not self.core_clusters:
self.core_clusters = []
clusters = []
for cn in self.core_names:
if cn not in clusters:
clusters.append(cn)
self.core_clusters.append(clusters.index(cn))
if len(self.core_names) != len(self.core_clusters):
raise ConfigError('core_names and core_clusters are of different lengths.')
def reset(self):
"""
Initiate rebooting of the device.