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