mirror of
https://github.com/ARM-software/devlib.git
synced 2025-01-31 02:00:45 +00:00
platform: smarter detection of big cores
If big_core is not explicitly specified by the user, it is populated by Platform (provided the target has exactly two clusters). Perviously this was done bu assuming that the target boots on little cluster and that the last CPU is big. This is still used as a fallback, but now Platform is ware of the names of big CPUs in currently existing big.LITTLE configurations and uses that first to identify the big.
This commit is contained in:
parent
59f4f81447
commit
47bf915b7c
@ -1,6 +1,9 @@
|
|||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
|
||||||
|
BIG_CPUS = ['A15', 'A57', 'A72']
|
||||||
|
|
||||||
|
|
||||||
class Platform(object):
|
class Platform(object):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -36,8 +39,7 @@ class Platform(object):
|
|||||||
self.core_names = target.cpuinfo.cpu_names
|
self.core_names = target.cpuinfo.cpu_names
|
||||||
self._set_core_clusters_from_core_names()
|
self._set_core_clusters_from_core_names()
|
||||||
if not self.big_core and self.number_of_clusters == 2:
|
if not self.big_core and self.number_of_clusters == 2:
|
||||||
big_idx = self.core_clusters.index(max(self.core_clusters))
|
self.big_core = self._identify_big_core()
|
||||||
self.big_core = self.core_names[big_idx]
|
|
||||||
if not self.core_clusters and self.core_names:
|
if not self.core_clusters and self.core_names:
|
||||||
self._set_core_clusters_from_core_names()
|
self._set_core_clusters_from_core_names()
|
||||||
if not self.model:
|
if not self.model:
|
||||||
@ -64,6 +66,13 @@ class Platform(object):
|
|||||||
except Exception: # pylint: disable=broad-except
|
except Exception: # pylint: disable=broad-except
|
||||||
pass # this is best-effort
|
pass # this is best-effort
|
||||||
|
|
||||||
|
def _identify_big_core(self):
|
||||||
|
for core in self.core_names:
|
||||||
|
if core.upper() in BIG_CPUS:
|
||||||
|
return core
|
||||||
|
big_idx = self.core_clusters.index(max(self.core_clusters))
|
||||||
|
return self.core_names[big_idx]
|
||||||
|
|
||||||
def _validate(self):
|
def _validate(self):
|
||||||
if len(self.core_names) != len(self.core_clusters):
|
if len(self.core_names) != len(self.core_clusters):
|
||||||
raise ValueError('core_names and core_clusters are of different lengths.')
|
raise ValueError('core_names and core_clusters are of different lengths.')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user