diff options
author | Stewart Smith <stewart@linux.vnet.ibm.com> | 2015-11-27 11:07:28 +1100 |
---|---|---|
committer | Nivedita Swaminathan <nivedita.swaminathan@intel.com> | 2015-12-09 15:08:45 -0800 |
commit | 9ac909bba40cda08ce2c68fed76d206d9a2d6387 (patch) | |
tree | 558965280295653a49ff5b53e803c7b84d0cfe2c | |
parent | 5b978daf11c619b66f4c96925570274e34f490d6 (diff) | |
download | powertop-2.0-9ac909bba40cda08ce2c68fed76d206d9a2d6387.tar.gz |
cpu: support powerpc /proc/cpuinfo
Clean up duplicate code added for ARM and add support for what
seems to be a good deliminator on ppc64.
This patch makes powertop pick up CPUs on powernv platform.
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r-- | src/cpu/cpu.cpp | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/src/cpu/cpu.cpp b/src/cpu/cpu.cpp index 9ca320f..64e1d3d 100644 --- a/src/cpu/cpu.cpp +++ b/src/cpu/cpu.cpp @@ -285,19 +285,13 @@ void enumerate_cpus(void) model = strtoull(c, NULL, 10); } } - if (strncasecmp(line, "bogomips\t", 9) == 0) { - if (number == -1) { - /* Not all /proc/cpuinfo include "processor\t". */ - number = 0; - } - if (number >= 0) { - handle_one_cpu(number, vendor, family, model); - set_max_cpu(number); - number = -2; - } - } - /* bogomips is removed in ARM, using CPU revision to enumerate */ - if (strncasecmp(line, "CPU revision\t", 13) == 0) { + /* on x86 and others 'bogomips' is last + * on ARM it *can* be bogomips, or 'CPU revision' + * on POWER, it's revision + */ + if (strncasecmp(line, "bogomips\t", 9) == 0 + || strncasecmp(line, "CPU revision\t", 13) == 0 + || strncmp(line, "revision", 7) == 0) { if (number == -1) { /* Not all /proc/cpuinfo include "processor\t". */ number = 0; |