From 4b76d5fc785269d75b997419f34f63e11ebbc8d2 Mon Sep 17 00:00:00 2001 From: seb Date: Sat, 16 Mar 2013 21:00:37 +0100 Subject: [PATCH] mpstat now takes into account every interrupt per processor so that their number adds up to the number displayed for CPU "all". mpstat used to sum only numerical interrupts (those with names like "0", "1", etc. and not "LOC", ...). But the number of interrupts per processor (displayed by mpstat -I SUM -P ALL) doesn't add up to what is displayed for "all". To fix this, take into account all interrupts per processor in /proc/interrupts file. Message from Shergill, Gurinder 13/03/2013: I am seeing something odd with mpstat. It shows 0 for all the CPUs except 0 even though there are interrupts going to other CPUs and the number doesn't add up to what is displayed for "all". I can confirm that there is very high level of I/O activity on the system (resulting in about 200k intr/s). I have tried multiple system and seen the same behavior. I have also tried multiple different kernels (3.7.10, 3.8.2, also the distro kernel with RHEL 6.3 & 6.4). Finally, I downloaded the latest sources for sysstat and built them on one of my systems, but even with that I get the same behavior. --- CHANGES | 3 +++ CREDITS | 1 + mpstat.c | 15 +++------------ 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/CHANGES b/CHANGES index 076c1d6..b8db491 100644 --- a/CHANGES +++ b/CHANGES @@ -1,11 +1,14 @@ Changes: xxxx/xx/xx: Version 10.1.5 - Sebastien Godard (sysstat orange.fr) + * mpstat now takes into account every interrupt per processor + so that their number adds up to the number displayed for CPU "all". * [Peter Schiffer]: systemd unit file couldn't be installed because PKG_PROG_PKG_CONFIG macro wasn't expanded in configure script. This is now fixed. * [Benno Schulenberg]: Fixed a small inconsistency in pidstat usage message. + * CREDITS file updated. 2013/03/08: Version 10.1.4 - Sebastien Godard (sysstat orange.fr) * [Christophe Cerin]: pidstat now stops and displays its average diff --git a/CREDITS b/CREDITS index e0ac159..fd70119 100644 --- a/CREDITS +++ b/CREDITS @@ -158,6 +158,7 @@ I would also thank the following people for their hints or bug reports Dr. David Alan Gilbert David Gesswein Frank Glinka + Gurinder Shergill Ladislav Hagara Don Harrop Jürgen Heinemann diff --git a/mpstat.c b/mpstat.c index 85e0dc6..1df0a35 100644 --- a/mpstat.c +++ b/mpstat.c @@ -114,7 +114,7 @@ void alarm_handler(int sig) * * IN: * @sig Signal number. - *************************************************************************** + ************************************************************************** */ void int_handler(int sig) { @@ -653,7 +653,7 @@ void read_interrupts_stat(char *file, struct stats_irqcpu *st_ic[], int ic_nr, i char *line = NULL, *li; unsigned long irq = 0; unsigned int cpu; - int cpu_index[cpu_nr], index = 0, dgt, len; + int cpu_index[cpu_nr], index = 0, len; char *cp, *next; for (cpu = 0; cpu < cpu_nr; cpu++) { @@ -700,12 +700,6 @@ void read_interrupts_stat(char *file, struct stats_irqcpu *st_ic[], int ic_nr, i } strncpy(p->irq_name, li, len); p->irq_name[len] = '\0'; - if (len > 0) { - dgt = isdigit(li[len - 1]); - } - else { - dgt = FALSE; - } for (cpu = 0; cpu < index; cpu++) { p = st_ic[curr] + cpu_index[cpu] * ic_nr + irq; @@ -715,10 +709,7 @@ void read_interrupts_stat(char *file, struct stats_irqcpu *st_ic[], int ic_nr, i * This is the same as st_irqcpu->irq. */ p->interrupt = strtoul(cp, &next, 10); - if (dgt) { - /* Sum only numerical irq (and not NMI, LOC, etc.) */ - st_irq_i->irq_nr += p->interrupt; - } + st_irq_i->irq_nr += p->interrupt; cp = next; } irq++; -- 2.40.0