rd_stats.c (sysstat-12.4.0.tar.xz) | : | rd_stats.c (sysstat-12.4.1.tar.xz) | ||
---|---|---|---|---|
skipping to change at line 443 | skipping to change at line 443 | |||
* Workaround for CPU coming back online: With recent kernels | * Workaround for CPU coming back online: With recent kernels | |||
* some fields (user, nice, system) restart from their previous value, | * some fields (user, nice, system) restart from their previous value, | |||
* whereas others (idle, iowait) restart from zero. | * whereas others (idle, iowait) restart from zero. | |||
* For the latter we need to set their previous value to zero to | * For the latter we need to set their previous value to zero to | |||
* avoid getting an interval value < 0. | * avoid getting an interval value < 0. | |||
* (I don't know how the other fields like hardirq, steal... behave). | * (I don't know how the other fields like hardirq, steal... behave). | |||
* Don't assume the CPU has come back from offline state if previous | * Don't assume the CPU has come back from offline state if previous | |||
* value was greater than ULLONG_MAX - 0x7ffff (the counter probably | * value was greater than ULLONG_MAX - 0x7ffff (the counter probably | |||
* overflew). | * overflew). | |||
*/ | */ | |||
if ((scc->cpu_iowait < scp->cpu_iowait) && (scp->cpu_iowait < (ULLONG_MAX | ||||
- 0x7ffff))) { | ||||
/* | ||||
* The iowait value reported by the kernel can also decrement as | ||||
* a result of inaccurate iowait tracking. Waiting on IO can be | ||||
* first accounted as iowait but then instead as idle. | ||||
* Therefore if the idle value during the same period did not | ||||
* decrease then consider this is a problem with the iowait | ||||
* reporting and correct the previous value according to the new | ||||
* reading. Otherwise, treat this as CPU coming back online. | ||||
*/ | ||||
if ((scc->cpu_idle > scp->cpu_idle) || (scp->cpu_idle >= (ULLONG_ | ||||
MAX - 0x7ffff))) { | ||||
scp->cpu_iowait = scc->cpu_iowait; | ||||
} | ||||
else { | ||||
scp->cpu_iowait = 0; | ||||
} | ||||
} | ||||
if ((scc->cpu_idle < scp->cpu_idle) && (scp->cpu_idle < (ULLONG_MAX - 0x7 ffff))) { | if ((scc->cpu_idle < scp->cpu_idle) && (scp->cpu_idle < (ULLONG_MAX - 0x7 ffff))) { | |||
scp->cpu_idle = 0; | scp->cpu_idle = 0; | |||
} | } | |||
if ((scc->cpu_iowait < scp->cpu_iowait) && (scp->cpu_iowait < (ULLONG_MAX | ||||
- 0x7ffff))) { | ||||
scp->cpu_iowait = 0; | ||||
} | ||||
/* | /* | |||
* Don't take cpu_guest and cpu_guest_nice into account | * Don't take cpu_guest and cpu_guest_nice into account | |||
* because cpu_user and cpu_nice already include them. | * because cpu_user and cpu_nice already include them. | |||
*/ | */ | |||
return ((scc->cpu_user + scc->cpu_nice + | return ((scc->cpu_user + scc->cpu_nice + | |||
scc->cpu_sys + scc->cpu_iowait + | scc->cpu_sys + scc->cpu_iowait + | |||
scc->cpu_idle + scc->cpu_steal + | scc->cpu_idle + scc->cpu_steal + | |||
scc->cpu_hardirq + scc->cpu_softirq) - | scc->cpu_hardirq + scc->cpu_softirq) - | |||
(scp->cpu_user + scp->cpu_nice + | (scp->cpu_user + scp->cpu_nice + | |||
End of changes. 2 change blocks. | ||||
4 lines changed or deleted | 19 lines changed or added |