1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-09-09 21:41:53 +01:00

cpufreq: add functions to get frequencies and governors for all online CPUs

This patch adds a couple of shutils functions to efficiently read all
the frequencies/governors and returne them into a dictionary indexed by
CPU id.

The shutils functions are returning a line per each CPU that can be easily
converted into a dictionary in the host side.

Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
This commit is contained in:
Patrick Bellasi
2015-11-27 16:40:58 +00:00
parent cf761317bd
commit 51b7f01d36
2 changed files with 42 additions and 0 deletions

View File

@@ -357,6 +357,19 @@ class CpufreqModule(Module):
'cpufreq_set_all_frequencies {}'.format(freq),
as_root=True)
def get_all_frequencies(self):
"""
Get the current frequency for all the (online) CPUs
"""
output = self.target._execute_util(
'cpufreq_get_all_frequencies', as_root=True)
frequencies = {}
for x in output.splitlines():
kv = x.split(' ')
if kv[0] == '':
break
frequencies[kv[0]] = kv[1]
return frequencies
def set_all_governors(self, governor):
"""
@@ -366,6 +379,19 @@ class CpufreqModule(Module):
'cpufreq_set_all_governors {}'.format(governor),
as_root=True)
def get_all_governors(self):
"""
Get the current governor for all the (online) CPUs
"""
output = self.target._execute_util(
'cpufreq_get_all_governors', as_root=True)
governors = {}
for x in output.splitlines():
kv = x.split(' ')
if kv[0] == '':
break
governors[kv[0]] = kv[1]
return governors
def trace_frequencies(self):
"""