]> granicus.if.org Git - sysstat/commitdiff
A_IRQ: sar: Display 0.00 when number of interrupts decreases
authorSebastien GODARD <sysstat@users.noreply.github.com>
Sun, 6 Feb 2022 16:47:58 +0000 (17:47 +0100)
committerSebastien GODARD <sysstat@users.noreply.github.com>
Sun, 6 Feb 2022 16:47:58 +0000 (17:47 +0100)
When a CPU goes offline, the number of interrupts among all CPU can
decrease. In this case, display a value of 0.00 instead of the huge
number that would appear otherwise.

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

index 6d62fd786c6dddfa44bb74494bda2ead92c6ab9c..fb4426cac09b30a2520e1ddaa95c8489f75c87cf 100644 (file)
@@ -397,8 +397,18 @@ __print_funct_t print_irq_stats(struct activity *a, int prev, int curr,
                                /* No */
                                continue;
 
-                       /* Yes: Display it */
-                       cprintf_f(NO_UNIT, 1, 9, 2, S_VALUE(stp_cpu_irq->irq_nr, stc_cpu_irq->irq_nr, itv));
+                       if (!c && (stc_cpu_irq->irq_nr < stp_cpu_irq->irq_nr)) {
+                               /*
+                                * Total number among all CPU for a given interrupt may decrease if
+                                * a CPU has gone offline. In this case we display "0.00" instead of
+                                * the huge number that would appear otherwise.
+                                */
+                               cprintf_f(NO_UNIT, 1, 9, 2, 0.0);
+                       }
+                       else {
+                               cprintf_f(NO_UNIT, 1, 9, 2,
+                                         S_VALUE(stp_cpu_irq->irq_nr, stc_cpu_irq->irq_nr, itv));
+                       }
 
                        if (DISPLAY_PRETTY(flags)) {
                                cprintf_in(IS_STR, " %9s", stc_cpuall_irq->irq_name, 0);