From: Sebastien GODARD Date: Sun, 6 Feb 2022 16:47:58 +0000 (+0100) Subject: A_IRQ: sar: Display 0.00 when number of interrupts decreases X-Git-Tag: v12.5.6~28 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5c1505821918565c9d13958fce387df1d135e74b;p=sysstat A_IRQ: sar: Display 0.00 when number of interrupts decreases 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 --- diff --git a/pr_stats.c b/pr_stats.c index 6d62fd7..fb4426c 100644 --- a/pr_stats.c +++ b/pr_stats.c @@ -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);