diff mbox

[1/2] Modified Powertop to support ARM processor

Message ID 1303119152-21856-2-git-send-email-amit.kachhap@linaro.org
State New
Headers show

Commit Message

Amit Daniel Kachhap April 18, 2011, 9:32 a.m. UTC
From: Amit Daniel Kachhap <amit.kachhap@linaro.org>

Added a compulsory field bogomips for each processor in case other
fields like model is missing. Error handling code added in case
of package id remains uninitialised.

Signed-off-by:  Amit Daniel Kachhap <amit.kachhap@linaro.org>
---
 cpu/cpu.cpp |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
diff mbox

Patch

diff --git a/cpu/cpu.cpp b/cpu/cpu.cpp
index 39f00e7..451c120 100644
--- a/cpu/cpu.cpp
+++ b/cpu/cpu.cpp
@@ -171,6 +171,8 @@  static void handle_one_cpu(unsigned int number, char *vendor, int family, int mo
 		file.close();
 	}
 
+	if (package_number == (unsigned int)-1)
+		package_number = 0;
 
 	if (system_level.children.size() <= package_number)
 		system_level.children.resize(package_number + 1, NULL);
@@ -263,6 +265,10 @@  void enumerate_cpus(void)
 			handle_one_cpu(number, vendor, family, model);
 			set_max_cpu(number);
 		}
+		if (strncasecmp(line, "bogomips\t",9) == 0) {
+			handle_one_cpu(number, vendor, family, model);
+			set_max_cpu(number);
+		}
 	}