]> granicus.if.org Git - sysstat/commitdiff
Change condition used in workaround for CPU coming back online
authorSebastien GODARD <sysstat@users.noreply.github.com>
Sat, 10 Mar 2018 14:08:49 +0000 (15:08 +0100)
committerSebastien GODARD <sysstat@users.noreply.github.com>
Sat, 10 Mar 2018 14:20:42 +0000 (15:20 +0100)
Compare counter's value to ULLONG_MAX - 0x7ffff (and not ULLONG_MAX &
0x80000) to guess if it has overflown.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
rd_stats.c

index 2c8c96775a14be902bb80f5967c6acc8af8899ea..8b578dd49c033f211241fb2cdd100e6a04532d2c 100644 (file)
@@ -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;
        }