sysstat/sysstat-9.0.4-cpu.patch
Ivana Hutarova Varekova eff579fcf2 - Resolves: #642280
sar -u overflow problem - thanks Michal Srb
2010-11-22 14:48:20 +01:00

23 lines
1004 B
Diff

diff -up sysstat-9.0.4/mpstat.c.pom sysstat-9.0.4/mpstat.c
--- sysstat-9.0.4/mpstat.c.pom 2010-11-10 11:58:55.000000000 +0100
+++ sysstat-9.0.4/mpstat.c 2010-11-10 11:58:30.000000000 +0100
@@ -271,6 +271,9 @@ void write_stats_core(int prev, int curr
/* Recalculate itv for current proc */
pc_itv = get_per_cpu_interval(scc, scp);
+ if ((scc->cpu_user - scc->cpu_guest) < (scp->cpu_user - scp->cpu_guest))
+ pc_itv = pc_itv + (scp->cpu_user - scp->cpu_guest) -
+ (scc->cpu_user - scc->cpu_guest);
/* if the CPU is offline it is omited from /proc/stat
so the sum of all values is zero */
@@ -291,6 +294,8 @@ void write_stats_core(int prev, int curr
else {
printf(" %6.2f %6.2f %6.2f %6.2f %6.2f %6.2f"
" %6.2f %6.2f %6.2f\n",
+ (scc->cpu_user - scc->cpu_guest) < (scp->cpu_user - scp->cpu_guest) ?
+ 0.0 :
ll_sp_value(scp->cpu_user - scp->cpu_guest,
scc->cpu_user - scc->cpu_guest,
pc_itv),