diff --git a/devlib/module/cpufreq.py b/devlib/module/cpufreq.py index d72b8fd..01fb79b 100644 --- a/devlib/module/cpufreq.py +++ b/devlib/module/cpufreq.py @@ -421,3 +421,14 @@ class CpufreqModule(Module): sysfile = '/sys/devices/system/cpu/{}/cpufreq/affected_cpus'.format(cpu) 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)