From patchwork Mon Apr 18 09:32:31 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Daniel Kachhap X-Patchwork-Id: 1068 Return-Path: Delivered-To: unknown Received: from imap.gmail.com (74.125.159.109) by localhost6.localdomain6 with IMAP4-SSL; 08 Jun 2011 14:48:48 -0000 Delivered-To: patches@linaro.org Received: by 10.224.67.148 with SMTP id r20cs28524qai; Mon, 18 Apr 2011 02:33:28 -0700 (PDT) Received: by 10.227.202.79 with SMTP id fd15mr4722512wbb.216.1303119207788; Mon, 18 Apr 2011 02:33:27 -0700 (PDT) Received: from mail-wy0-f178.google.com (mail-wy0-f178.google.com [74.125.82.178]) by mx.google.com with ESMTPS id j7si9718635wbj.25.2011.04.18.02.33.24 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 18 Apr 2011 02:33:26 -0700 (PDT) Received-SPF: pass (google.com: domain of amitdanielk@gmail.com designates 74.125.82.178 as permitted sender) client-ip=74.125.82.178; Authentication-Results: mx.google.com; spf=pass (google.com: domain of amitdanielk@gmail.com designates 74.125.82.178 as permitted sender) smtp.mail=amitdanielk@gmail.com; dkim=pass (test mode) header.i=@gmail.com Received: by wyb33 with SMTP id 33so4581744wyb.37 for ; Mon, 18 Apr 2011 02:33:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:sender:from:to:cc:subject:date:message-id :x-mailer:in-reply-to:references; bh=XQW4w+FPnebz2fR2VXnVAVU4GLGYM+/FFB85QQdYhoA=; b=hEvCFNY6TJ6+k7vFF5cL396plZET5eV7ciVbxT8rmLwK6uVX9Xh0lXNfH+YoENrppd 0G2o5NmRekh9/d5g3EjmdRvwMdhsqLsR9azruf/gwB2TmCGBFgJV7x/D/FK5NPgy5OaT lR4QEKJihaznZKY1/K1C/9PMLBDQkJlDoRi34= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; b=tegWugaZ5lCYD3vRN2U5HfAWteqy4pJfvIfGPUUd4bsLZVxZzSOkjdqpsj5PLe9nL2 RdQGGQcoWpko7cUKfTm3T9PGU8EHewHOv2adbt7VHLOv/wVaBmplEm1r8RNW1YqI50ur R/2XeTxpIAQm075xolPjg8hJNe5g8nVNuX21k= Received: by 10.216.121.200 with SMTP id r50mr2183341weh.7.1303119204366; Mon, 18 Apr 2011 02:33:24 -0700 (PDT) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPS id u9sm3135236wbg.34.2011.04.18.02.33.19 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 18 Apr 2011 02:33:23 -0700 (PDT) Sender: amit kachhap From: amit.kachhap@linaro.org To: power@bughost.org Cc: linaro-dev@lists.linaro.org, amit.kachhap@linaro.org, patches@linaro.org Subject: [PATCH 1/2] Modified Powertop to support ARM processor Date: Mon, 18 Apr 2011 15:02:31 +0530 Message-Id: <1303119152-21856-2-git-send-email-amit.kachhap@linaro.org> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1303119152-21856-1-git-send-email-amit.kachhap@linaro.org> References: <1303119152-21856-1-git-send-email-amit.kachhap@linaro.org> From: Amit Daniel Kachhap 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 --- cpu/cpu.cpp | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) 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); + } }