From: Sebastien GODARD Date: Sat, 10 Mar 2018 14:08:49 +0000 (+0100) Subject: Change condition used in workaround for CPU coming back online X-Git-Tag: v11.7.3~21 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9057b41fcbf509a6dd2cefe8be31c7181e3c905c;p=sysstat Change condition used in workaround for CPU coming back online Compare counter's value to ULLONG_MAX - 0x7ffff (and not ULLONG_MAX & 0x80000) to guess if it has overflown. Signed-off-by: Sebastien GODARD --- diff --git a/rd_stats.c b/rd_stats.c index 2c8c967..8b578dd 100644 --- a/rd_stats.c +++ b/rd_stats.c @@ -432,13 +432,13 @@ unsigned long long get_per_cpu_interval(struct stats_cpu *scc, * avoid getting an interval value < 0. * (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 - * value was greater than ULLONG_MAX & 0x80000 (the counter probably + * value was greater than ULLONG_MAX - 0x7ffff (the counter probably * overflew). */ - if ((scc->cpu_idle < scp->cpu_idle) && (scp->cpu_idle < (ULLONG_MAX & 0x80000))) { + if ((scc->cpu_idle < scp->cpu_idle) && (scp->cpu_idle < (ULLONG_MAX - 0x7ffff))) { scp->cpu_idle = 0; } - if ((scc->cpu_iowait < scp->cpu_iowait) && (scp->cpu_iowait < (ULLONG_MAX & 0x80000))) { + if ((scc->cpu_iowait < scp->cpu_iowait) && (scp->cpu_iowait < (ULLONG_MAX - 0x7ffff))) { scp->cpu_iowait = 0; }