Powertop looks for "model" field in /proc/cpuinfo. This field is not
populated on ARM platforms.  Key off "bogomips" instead since it
is present on both x86 and ARM platforms.

In addition, /sys/devices/system/cpu/cpu*/topology/physical_package_id
is un-initialized (set to -1) on ARM platforms.  Added safety valve to
deal with this.

Signed-off-by: Sameer Nanda <[email protected]>

diff --git a/cpu/cpu.cpp b/cpu/cpu.cpp
index 39f00e7..cab2061 100644
--- a/cpu/cpu.cpp
+++ b/cpu/cpu.cpp
@@ -168,6 +168,8 @@ static void handle_one_cpu(unsigned int number,
char *vendor, int family, int mo
        file.open(filename, ios::in);
        if (file) {
                file >> package_number;
+               if (package_number == (unsigned int) -1)
+                       package_number = 0;
               }

@@ -260,6 +262,8 @@ void enumerate_cpus(void)
                                c++;
                                model = strtoull(c, NULL, 10);
                        }
+               }
+               if (strncasecmp(line, "bogomips\t",9) == 0) {
                        handle_one_cpu(number, vendor, family, model);
                        set_max_cpu(number);
                }
         file.close();

-- 
Sameer

_______________________________________________
Power mailing list
[email protected]
http://www.bughost.org/mailman/listinfo/power

Reply via email to