From ca9eb93bc650aa8aed188ff9751222991abc6551 Mon Sep 17 00:00:00 2001 From: Ivana Varekova Date: Apr 19 2010 09:12:40 +0000 Subject: - fix mpstat tool (when the cpu is switched off) --- diff --git a/sysstat-9.0.6.1-tickless.patch b/sysstat-9.0.6.1-tickless.patch index ac2694c..f3c3b2e 100644 --- a/sysstat-9.0.6.1-tickless.patch +++ b/sysstat-9.0.6.1-tickless.patch @@ -1,16 +1,42 @@ -diff -up sysstat-9.0.6.1/mpstat.c.pom sysstat-9.0.6.1/mpstat.c ---- sysstat-9.0.6.1/mpstat.c.pom 2009-09-12 20:59:04.000000000 +0200 -+++ sysstat-9.0.6.1/mpstat.c 2010-04-16 14:32:06.000000000 +0200 -@@ -273,9 +273,10 @@ void write_stats_core(int prev, int curr +diff -up sysstat-9.0.6.1/mpstat.c.tl sysstat-9.0.6.1/mpstat.c +--- sysstat-9.0.6.1/mpstat.c.tl 2009-09-12 20:59:04.000000000 +0200 ++++ sysstat-9.0.6.1/mpstat.c 2010-04-19 10:42:01.000000000 +0200 +@@ -272,10 +272,21 @@ void write_stats_core(int prev, int curr + /* Recalculate itv for current proc */ pc_itv = get_per_cpu_interval(scc, scp); - if (!pc_itv) { +- if (!pc_itv) { - /* Current CPU is offline */ -+ /* Current CPU is tickless -+ if the CPU is offline it is omited from /proc/stat */ ++ /* if the CPU is offline it is omited from /proc/stat ++ so the sum of all values is zero */ ++ if ((scc->cpu_user + scc->cpu_nice + scc->cpu_sys + ++ scc->cpu_iowait + scc->cpu_idle + scc->cpu_steal + ++ scc->cpu_hardirq + scc->cpu_softirq) == 0) { printf(" 0.00 0.00 0.00 0.00 0.00 0.00" -- " 0.00 0.00 0.00\n"); -+ " 0.00 0.00 100.00\n"); + " 0.00 0.00 0.00\n"); ++ continue; ++ } ++ ++ /* if the CPU is tickless then ++ there is no change in CPU values but the sum of values is not null */ ++ if (!pc_itv) { ++ printf(" 0.00 0.00 0.00 0.00 0.00 0.00" ++ " 0.00 0.00 100.00\n"); } else { printf(" %6.2f %6.2f %6.2f %6.2f %6.2f %6.2f" +@@ -643,6 +654,14 @@ void rw_mpstat_loop(int dis_hdr, int row + scc = st_cpu[curr] + cpu; + scp = st_cpu[!curr] + cpu; + *scc = *scp; ++ scc->cpu_user = 0; ++ scc->cpu_nice = 0; ++ scc->cpu_sys = 0; ++ scc->cpu_iowait = 0; ++ scc->cpu_idle = 0; ++ scc->cpu_steal = 0; ++ scc->cpu_hardirq = 0; ++ scc->cpu_softirq = 0; + } + + /* Get time */ diff --git a/sysstat.spec b/sysstat.spec index 802fa76..cb4700c 100644 --- a/sysstat.spec +++ b/sysstat.spec @@ -1,6 +1,6 @@ Name: sysstat Version: 9.0.6.1 -Release: 2%{?dist} +Release: 3%{?dist} Summary: The sar and iostat system monitoring commands License: GPLv2+ Group: Applications/System @@ -83,6 +83,9 @@ rm -rf %{buildroot} %{_localstatedir}/log/sa %changelog +* Mon Apr 19 2010 Ivana Hutarova Varekova - 9.0.6.1-3 +- fix mpstat tool (when the cpu is switched off) + * Fri Apr 16 2010 Ivana Hutarova Varekova - 9.0.6.1-2 - fix the mpstat output on tickless kernel