From: Shawn Bohrer Only count directories that match /sys/devices/system/cpu/cpu[0-9]+ as CPUs. Previously any directory that started with cpu was counted which caused cpufreq and cpuidle to be counted as CPUs. Signed-off-by: Shawn Bohrer --- cputree.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/cputree.c b/cputree.c index 3b0c982..b879785 100644 --- a/cputree.c +++ b/cputree.c @@ -25,6 +25,7 @@ */ #include "config.h" +#include #include #include #include @@ -321,7 +322,7 @@ void parse_cpu_tree(void) return; do { entry = readdir(dir); - if (entry && strlen(entry->d_name)>3 && strstr(entry->d_name,"cpu")) { + if (entry && !strncmp(entry->d_name,"cpu", 3) && isdigit(entry->d_name[3])) { char new_path[PATH_MAX]; sprintf(new_path, "/sys/devices/system/cpu/%s", entry->d_name); do_one_cpu(new_path); -- 1.6.5.2