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

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