cpu: Fix leftovers from the P state cpu frequency calculation
Namhyung Kim
PATCH 1/1 cpu: Fix leftovers from the P state cpu frequency calculation
The commit 15b8bfb ("Ignore non-P-state-enabled CPUs when calculating frequency") and 29f42b5 ("fixed issues with p-state reported CPU frequencies") fixed frequency calculation for cpu packages but missed it for cpu cores. Add it.
This fixes wrong frequency report on my quad-core box: 2072.5% -> 100.0%
Cc Ivan Shapovalov <intelfx100(a)gmail.com>
Signed-off-by Namhyung Kim <namhyung(a)gmail.com>
--- src/cpu/cpu_core.cpp | 3 +-- src/cpu/intel_cpus.cpp | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-)
src/cpu/cpu_core.cpp +1 -2
@@ -131,10 +131,9 @@ void cpu_core::calculate_freq(uint64_t time) bool is_idle = true; unsigned int i; - /* calculate the maximum frequency of all children */ for (i = 0; i < children.size(); i++) - if (children[i]) { + if (children[i] && children[i]->has_pstates()) { uint64_t f = 0; if (!children[i]->idle) { f = children[i]->current_frequency;
src/cpu/intel_cpus.cpp +1 -1
@@ -240,7 +240,7 @@ void nhm_core::calculate_freq(uint64_t time) /* calculate the maximum frequency of all children */ for (i = 0; i < children.size(); i++) - if (children[i]) { + if (children[i] && children[i]->has_pstates()) { uint64_t f = 0; if (!children[i]->idle) { f = children[i]->current_frequency;
Signature · 1 line
1.7.9.2