1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-04-05 17:30:03 +01:00

Merge pull request #124 from bjackman/cpufreq-iter-domains

Add iter_domains method to cpufreq module
This commit is contained in:
setrofim 2017-05-17 16:51:19 +01:00 committed by GitHub
commit 4e0c03ebdd

View File

@ -421,3 +421,14 @@ class CpufreqModule(Module):
sysfile = '/sys/devices/system/cpu/{}/cpufreq/affected_cpus'.format(cpu) sysfile = '/sys/devices/system/cpu/{}/cpufreq/affected_cpus'.format(cpu)
return [int(c) for c in self.target.read_value(sysfile).split()] return [int(c) for c in self.target.read_value(sysfile).split()]
def iter_domains(self):
"""
Iterate over the frequency domains in the system
"""
cpus = set(range(self.target.number_of_cpus))
while cpus:
cpu = iter(cpus).next()
domain = self.target.cpufreq.get_domain_cpus(cpu)
yield domain
cpus = cpus.difference(domain)