cpu: Fix verification of EPB on Linux 4.13+
Fix verification of Energy Performance Bias on Linux 4.13+. In Linux 4.13, the value strings accepted by the x86_energy_perf_policy program changed. Resolves: rhbz#1508468 Signed-off-by: Ondřej Lysoněk <olysonek@redhat.com>
This commit is contained in:
parent
c2eb0858d1
commit
3104141ff6
1 changed files with 13 additions and 0 deletions
|
|
@ -282,9 +282,19 @@ class CPULatencyPlugin(base.Plugin):
|
||||||
v = s
|
v = s
|
||||||
return v
|
return v
|
||||||
|
|
||||||
|
# Before Linux 4.13
|
||||||
def _energy_perf_policy_to_human(self, s):
|
def _energy_perf_policy_to_human(self, s):
|
||||||
return {0:"performance", 6:"normal", 15:"powersave"}.get(self._try_parse_num(s), s)
|
return {0:"performance", 6:"normal", 15:"powersave"}.get(self._try_parse_num(s), s)
|
||||||
|
|
||||||
|
# Since Linux 4.13
|
||||||
|
def _energy_perf_policy_to_human_v2(self, s):
|
||||||
|
return {0:"performance",
|
||||||
|
4:"balance-performance",
|
||||||
|
6:"normal",
|
||||||
|
8:"balance-power",
|
||||||
|
15:"power",
|
||||||
|
}.get(self._try_parse_num(s), s)
|
||||||
|
|
||||||
@command_get("energy_perf_bias")
|
@command_get("energy_perf_bias")
|
||||||
def _get_energy_perf_bias(self, device, ignore_missing=False):
|
def _get_energy_perf_bias(self, device, ignore_missing=False):
|
||||||
energy_perf_bias = None
|
energy_perf_bias = None
|
||||||
|
|
@ -300,5 +310,8 @@ class CPULatencyPlugin(base.Plugin):
|
||||||
if len(l) == 2:
|
if len(l) == 2:
|
||||||
energy_perf_bias = self._energy_perf_policy_to_human(l[1])
|
energy_perf_bias = self._energy_perf_policy_to_human(l[1])
|
||||||
break
|
break
|
||||||
|
elif len(l) == 3:
|
||||||
|
energy_perf_bias = self._energy_perf_policy_to_human_v2(l[2])
|
||||||
|
break
|
||||||
|
|
||||||
return energy_perf_bias
|
return energy_perf_bias
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue