sysstat/sysstat-9.0.4-cpu.patch

23 lines
1004 B
Diff
Raw Normal View History

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),