Blame SOURCES/0001-sar-Improve-cpuinfo-read-for-POWER-architecture.patch

67ba6f
From 81ef06797b16d08a4558a41891b9d9421a0a96f8 Mon Sep 17 00:00:00 2001
67ba6f
From: Breno Leitao <breno.leitao@gmail.com>
67ba6f
Date: Mon, 31 Oct 2016 09:23:59 -0400
67ba6f
Subject: [PATCH] sar: Improve cpuinfo read for POWER architecture
67ba6f
67ba6f
Currently CPU frequency is not being read properly on POWER archicture.
67ba6f
It shows the frequency as:
67ba6f
  # sar -m CPU 1 5
67ba6f
...
67ba6f
  06:30:28 AM     CPU       MHz
67ba6f
  06:30:36 AM     all      0.00
67ba6f
67ba6f
This is caused because /proc/cpuinfo is differently between Intel and
67ba6f
POWER.
67ba6f
This patch simply fix the parsing function (read_cpuinfo).
67ba6f
67ba6f
Signed-off-by: Breno Leitao <breno.leitao@gmail.com>
67ba6f
67ba6f
Resolves: #1440000
67ba6f
---
67ba6f
 rd_stats.c | 10 ++++++----
67ba6f
 1 file changed, 6 insertions(+), 4 deletions(-)
67ba6f
67ba6f
diff --git a/rd_stats.c b/rd_stats.c
67ba6f
index dafd975..d8c337a 100644
67ba6f
--- a/rd_stats.c
67ba6f
+++ b/rd_stats.c
67ba6f
@@ -1625,10 +1625,12 @@ void read_cpuinfo(struct stats_pwr_cpufreq *st_pwr_cpufreq, int nbr)
67ba6f
 		if (!strncmp(line, "processor\t", 10)) {
67ba6f
 			sscanf(strchr(line, ':') + 1, "%d", &proc_nb);
67ba6f
 		}
67ba6f
-		
67ba6f
-		else if (!strncmp(line, "cpu MHz\t", 8)) {
67ba6f
-			sscanf(strchr(line, ':') + 1, "%u.%u", &ifreq, &dfreq);
67ba6f
-			
67ba6f
+
67ba6f
+                /* Entry in /proc/cpuinfo is different between Intel and Power architectures */
67ba6f
+		else if (!strncmp(line, "cpu MHz\t", 8) ||
67ba6f
+			 !strncmp(line, "clock\t", 6)) {
67ba6f
+                        sscanf(strchr(line, ':') + 1, "%u.%u", &ifreq, &dfreq);
67ba6f
+
67ba6f
 			if (proc_nb < (nbr - 1)) {
67ba6f
 				/* Save current CPU frequency */
67ba6f
 				st_pwr_cpufreq_i = st_pwr_cpufreq + proc_nb + 1;
67ba6f
-- 
67ba6f
2.13.6
67ba6f