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

cpuidle: Make desc, name, latency, power memoized properties

When this information is not needed, this avoids executing 4 commands on
the host for each CPU, which significantly speeds up initialising the
cpuidle module.
This commit is contained in:
Brendan Jackman 2016-10-12 18:24:15 +01:00
parent 1a47cadfa7
commit d3a02d9d9e

View File

@ -47,10 +47,26 @@ class CpuidleState(object):
self.path = path self.path = path
self.id = self.target.path.basename(self.path) self.id = self.target.path.basename(self.path)
self.cpu = self.target.path.basename(self.target.path.dirname(path)) self.cpu = self.target.path.basename(self.target.path.dirname(path))
self.desc = self.get('desc')
self.name = self.get('name') @property
self.latency = self.get('latency') @memoized
self.power = self.get('power') def desc(self):
return self.get('desc')
@property
@memoized
def name(self):
return self.get('name')
@property
@memoized
def latency(self):
return self.get('latency')
@property
@memoized
def power(self):
return self.get('power')
def enable(self): def enable(self):
self.set('disable', 0) self.set('disable', 0)