diff options
author | Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> | 2014-12-16 16:09:06 +0000 |
---|---|---|
committer | Alexandra Yates <alexandra.yates@linux.intel.com> | 2015-09-17 17:10:10 -0700 |
commit | ab5e15d469cc62d654e62ff64a673bd10f73702d (patch) | |
tree | 15e6ec48781bb829ceba93bf573c07b6ddaa970a | |
parent | 6a84298f721d3b55c546f00f42823367eb4df915 (diff) | |
download | powertop-2.0-ab5e15d469cc62d654e62ff64a673bd10f73702d.tar.gz |
powertop: fix erroneous C state detection on ARM
When the kernel is configured with CONFIG_CPU_IDLE_MULTIPLE_DRIVERS,
the cpuidle directory contains a "driver" subdirectory that confuses
the current code parsing the C states on ARM platforms, ending up
with a C state entry corresponding to the actual driver name instead
of a proper C state entry.
This patch fixes the code by stopping the parsing if the files that
characterise the C states (ie usage) are not found in the respective:
/sys/devices/system/cpu/cpuX/cpuidle
subdirectory containing C states information.
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Tested-by: Kevin Hilman <khilman@linaro.org>
-rw-r--r-- | src/cpu/cpu_linux.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/cpu/cpu_linux.cpp b/src/cpu/cpu_linux.cpp index 6d0fa62..e19fba1 100644 --- a/src/cpu/cpu_linux.cpp +++ b/src/cpu/cpu_linux.cpp @@ -83,7 +83,8 @@ void cpu_linux::parse_cstates_start(void) if (file) { file >> usage; file.close(); - } + } else + continue; snprintf(filename + len, 256 - len, "/%s/time", entry->d_name); @@ -172,7 +173,8 @@ void cpu_linux::parse_cstates_end(void) if (file) { file >> usage; file.close(); - } + } else + continue; snprintf(filename + len, 256 - len, "/%s/time", entry->d_name); |