diff options
Diffstat (limited to 'devlib/module/cpufreq.py')
-rw-r--r-- | devlib/module/cpufreq.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/devlib/module/cpufreq.py b/devlib/module/cpufreq.py index d72b8fd..e18d95b 100644 --- a/devlib/module/cpufreq.py +++ b/devlib/module/cpufreq.py @@ -382,7 +382,9 @@ class CpufreqModule(Module): 'cpufreq_set_all_governors {}'.format(governor), as_root=True) except TargetError as e: - if "echo: I/O error" in str(e): + if ("echo: I/O error" in str(e) or + "write error: Invalid argument" in str(e)): + cpus_unsupported = [c for c in self.target.list_online_cpus() if governor not in self.list_governors(c)] raise TargetError("Governor {} unsupported for CPUs {}".format( @@ -421,3 +423,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) |