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

Merge pull request #63 from bjackman/get-domain-cpus

cpufreq: Add function to get CPUs in frequency domain
This commit is contained in:
setrofim 2016-10-12 08:29:14 +01:00 committed by GitHub
commit 1a47cadfa7

View File

@ -408,3 +408,14 @@ class CpufreqModule(Module):
"""
return self.target._execute_util('cpufreq_trace_all_frequencies', as_root=True)
@memoized
def get_domain_cpus(self, cpu):
"""
Get the CPUs that share a frequency domain with the given CPU
"""
if isinstance(cpu, int):
cpu = 'cpu{}'.format(cpu)
sysfile = '/sys/devices/system/cpu/{}/cpufreq/affected_cpus'.format(cpu)
return [int(c) for c in self.target.read_value(sysfile).split()]