irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
/*
|
|
|
|
* irqtop.c - utility to display kernel interrupt information.
|
|
|
|
*
|
|
|
|
* zhenwei pi <pizhenwei@bytedance.com>
|
|
|
|
*
|
|
|
|
* Copyright (C) 2019 zhenwei pi
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
2020-01-03 15:06:43 -06:00
|
|
|
#include <ctype.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <getopt.h>
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
#include <limits.h>
|
|
|
|
#include <locale.h>
|
2020-01-03 15:06:43 -06:00
|
|
|
#include <signal.h>
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
#include <stdio.h>
|
2020-01-03 15:06:43 -06:00
|
|
|
#include <stdlib.h>
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
#include <string.h>
|
2020-01-05 03:27:19 -06:00
|
|
|
#include <sys/epoll.h>
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
#include <sys/ioctl.h>
|
|
|
|
#include <sys/select.h>
|
2020-01-05 03:27:19 -06:00
|
|
|
#include <sys/signalfd.h>
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
#include <sys/time.h>
|
2020-01-05 03:27:19 -06:00
|
|
|
#include <sys/timerfd.h>
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
#include <sys/types.h>
|
2020-01-03 15:06:43 -06:00
|
|
|
#include <termios.h>
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
#include <unistd.h>
|
|
|
|
|
2020-01-03 15:06:43 -06:00
|
|
|
#ifdef HAVE_SLCURSES_H
|
|
|
|
# include <slcurses.h>
|
|
|
|
#elif defined(HAVE_SLANG_SLCURSES_H)
|
|
|
|
# include <slang/slcurses.h>
|
|
|
|
#elif defined(HAVE_NCURSESW_NCURSES_H) && defined(HAVE_WIDECHAR)
|
|
|
|
# include <ncursesw/ncurses.h>
|
|
|
|
#elif defined(HAVE_NCURSES_H)
|
|
|
|
# include <ncurses.h>
|
|
|
|
#elif defined(HAVE_NCURSES_NCURSES_H)
|
|
|
|
# include <ncurses/ncurses.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_WIDECHAR
|
|
|
|
# include <wctype.h>
|
|
|
|
# include <wchar.h>
|
|
|
|
#endif
|
|
|
|
|
2020-02-08 10:00:20 -06:00
|
|
|
#include <libsmartcols.h>
|
|
|
|
|
2020-01-03 15:06:43 -06:00
|
|
|
#include "c.h"
|
|
|
|
#include "closestream.h"
|
2020-01-04 01:45:43 -06:00
|
|
|
#include "monotonic.h"
|
2020-01-03 15:06:43 -06:00
|
|
|
#include "nls.h"
|
|
|
|
#include "pathnames.h"
|
2020-01-04 02:32:42 -06:00
|
|
|
#include "strutils.h"
|
2020-01-05 04:40:12 -06:00
|
|
|
#include "timeutils.h"
|
2020-01-04 01:33:01 -06:00
|
|
|
#include "ttyutils.h"
|
2020-01-04 01:40:49 -06:00
|
|
|
#include "xalloc.h"
|
2020-01-03 15:06:43 -06:00
|
|
|
|
2020-02-22 10:42:56 -06:00
|
|
|
#define DEF_SORT_FUNC sort_total
|
2020-02-22 09:19:09 -06:00
|
|
|
#define IRQ_INFO_LEN 64
|
|
|
|
#define MAX_EVENTS 3
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
|
2020-02-08 10:00:20 -06:00
|
|
|
struct colinfo {
|
|
|
|
const char *name;
|
|
|
|
double whint;
|
|
|
|
int flags;
|
|
|
|
const char *help;
|
|
|
|
int json_type;
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
COL_IRQ,
|
2020-02-22 10:42:56 -06:00
|
|
|
COL_TOTAL,
|
|
|
|
COL_DELTA,
|
2020-02-22 09:19:09 -06:00
|
|
|
COL_NAME
|
2020-02-08 10:00:20 -06:00
|
|
|
};
|
|
|
|
|
2020-02-24 12:26:38 -06:00
|
|
|
static const struct colinfo infos[] = {
|
|
|
|
[COL_IRQ] = {"IRQ", 0.10, SCOLS_FL_RIGHT, N_("interrupts"), SCOLS_JSON_STRING},
|
2020-02-22 10:42:56 -06:00
|
|
|
[COL_TOTAL] = {"TOTAL", 0.10, SCOLS_FL_RIGHT, N_("total count"), SCOLS_JSON_NUMBER},
|
|
|
|
[COL_DELTA] = {"DELTA", 0.10, SCOLS_FL_RIGHT, N_("delta count"), SCOLS_JSON_NUMBER},
|
2020-02-24 12:26:38 -06:00
|
|
|
[COL_NAME] = {"NAME", 0.70, SCOLS_FL_TRUNC, N_("name"), SCOLS_JSON_STRING},
|
2020-02-08 10:00:20 -06:00
|
|
|
};
|
|
|
|
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
struct irq_info {
|
2020-02-23 01:39:11 -06:00
|
|
|
char *irq; /* short name of this irq */
|
|
|
|
char *name; /* descriptive name of this irq */
|
2020-02-22 10:42:56 -06:00
|
|
|
unsigned long total; /* total count since system start up */
|
|
|
|
unsigned long delta; /* delta count since previous update */
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
struct irq_stat {
|
2020-01-03 15:06:43 -06:00
|
|
|
unsigned int nr_irq; /* number of irq vector */
|
2019-12-25 03:56:07 -06:00
|
|
|
unsigned int nr_irq_info; /* number of irq info */
|
|
|
|
struct irq_info *irq_info; /* array of irq_info */
|
2020-01-03 15:06:43 -06:00
|
|
|
long nr_active_cpu; /* number of active cpu */
|
|
|
|
unsigned long total_irq; /* total irqs */
|
2020-02-22 10:42:56 -06:00
|
|
|
unsigned long delta_irq; /* delta irqs */
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
};
|
|
|
|
|
2020-02-24 12:26:38 -06:00
|
|
|
typedef int (sort_fp)(const struct irq_info *, const struct irq_info *);
|
|
|
|
|
2020-01-04 02:08:17 -06:00
|
|
|
struct irqtop_ctl {
|
|
|
|
WINDOW *win;
|
|
|
|
int cols;
|
|
|
|
int rows;
|
2020-01-05 03:00:28 -06:00
|
|
|
int old_rows;
|
2020-01-05 03:27:19 -06:00
|
|
|
struct itimerspec timer;
|
2020-01-05 03:00:28 -06:00
|
|
|
struct timeval uptime_tv;
|
2020-02-24 12:26:38 -06:00
|
|
|
sort_fp *sort_func;
|
2020-01-04 02:08:17 -06:00
|
|
|
long smp_num_cpus;
|
2020-02-21 16:28:43 -06:00
|
|
|
struct irq_stat *prev_stat;
|
2020-01-05 04:40:12 -06:00
|
|
|
char *hostname;
|
2020-02-08 10:00:20 -06:00
|
|
|
struct libscols_table *table;
|
|
|
|
struct libscols_line *outline;
|
|
|
|
int columns[ARRAY_SIZE(infos)];
|
|
|
|
size_t ncolumns;
|
2020-01-04 02:08:17 -06:00
|
|
|
unsigned int
|
2020-02-22 10:42:56 -06:00
|
|
|
specific_columns:1,
|
2020-02-08 10:00:20 -06:00
|
|
|
json:1,
|
|
|
|
no_headings:1,
|
2020-01-04 02:32:42 -06:00
|
|
|
request_exit:1,
|
2020-01-04 02:08:17 -06:00
|
|
|
run_once:1;
|
|
|
|
};
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
|
2020-02-24 12:26:38 -06:00
|
|
|
static int column_name_to_id(char const *const name, size_t const namesz)
|
2020-02-08 10:00:20 -06:00
|
|
|
{
|
|
|
|
size_t i;
|
|
|
|
|
|
|
|
assert(name);
|
|
|
|
for (i = 0; i < ARRAY_SIZE(infos); i++) {
|
|
|
|
const char *cn = infos[i].name;
|
|
|
|
|
|
|
|
if (!strncasecmp(name, cn, namesz) && !*(cn + namesz))
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
warnx(_("unknown column: %s"), name);
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2020-02-24 12:26:38 -06:00
|
|
|
static inline int get_column_id(struct irqtop_ctl const *const ctl, size_t const num)
|
2020-02-08 10:00:20 -06:00
|
|
|
{
|
|
|
|
assert(num < ctl->ncolumns);
|
|
|
|
assert(ctl->columns[num] < (int)ARRAY_SIZE(infos));
|
|
|
|
|
|
|
|
return ctl->columns[num];
|
|
|
|
}
|
|
|
|
|
2020-02-24 12:26:38 -06:00
|
|
|
static inline struct colinfo const *get_column_info(struct irqtop_ctl const
|
|
|
|
*const ctl,
|
|
|
|
unsigned const num)
|
2020-02-08 10:00:20 -06:00
|
|
|
{
|
|
|
|
return &infos[get_column_id(ctl, num)];
|
|
|
|
}
|
|
|
|
|
2020-02-24 12:26:38 -06:00
|
|
|
static void add_scols_line(struct irqtop_ctl *const ctl, struct irq_info const *const stat)
|
2020-02-08 10:00:20 -06:00
|
|
|
{
|
|
|
|
size_t i;
|
|
|
|
struct libscols_line *line;
|
|
|
|
|
|
|
|
line = scols_table_new_line(ctl->table, NULL);
|
|
|
|
if (!line) {
|
|
|
|
warn(_("failed to add line to output"));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < ctl->ncolumns; i++) {
|
|
|
|
char *str = NULL;
|
|
|
|
|
|
|
|
switch (get_column_id(ctl, i)) {
|
|
|
|
case COL_IRQ:
|
|
|
|
xasprintf(&str, "%s", stat->irq);
|
|
|
|
break;
|
2020-02-22 10:42:56 -06:00
|
|
|
case COL_TOTAL:
|
|
|
|
xasprintf(&str, "%ld", stat->total);
|
|
|
|
break;
|
|
|
|
case COL_DELTA:
|
|
|
|
xasprintf(&str, "%ld", stat->delta);
|
2020-02-08 10:00:20 -06:00
|
|
|
break;
|
2020-02-22 09:19:09 -06:00
|
|
|
case COL_NAME:
|
|
|
|
xasprintf(&str, "%s", stat->name);
|
2020-02-08 10:00:20 -06:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (str && scols_line_refer_data(line, i, str) != 0)
|
|
|
|
err_oom();
|
|
|
|
}
|
|
|
|
ctl->outline = line;
|
2020-02-23 01:39:11 -06:00
|
|
|
free(stat->irq);
|
|
|
|
free(stat->name);
|
2020-02-08 10:00:20 -06:00
|
|
|
}
|
|
|
|
|
2020-02-24 12:26:38 -06:00
|
|
|
static int init_scols_table(struct irqtop_ctl *const ctl)
|
2020-02-08 10:00:20 -06:00
|
|
|
{
|
|
|
|
size_t i;
|
|
|
|
|
|
|
|
ctl->table = scols_new_table();
|
|
|
|
if (!ctl->table) {
|
|
|
|
warn(_("failed to initialize output table"));
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
scols_table_enable_json(ctl->table, ctl->json);
|
|
|
|
scols_table_enable_noheadings(ctl->table, ctl->no_headings);
|
|
|
|
|
|
|
|
if (ctl->json)
|
2020-02-24 12:26:38 -06:00
|
|
|
scols_table_set_name(ctl->table, _("interrupts"));
|
2020-02-08 10:00:20 -06:00
|
|
|
|
|
|
|
for (i = 0; i < ctl->ncolumns; i++) {
|
2020-02-24 12:26:38 -06:00
|
|
|
struct colinfo const *const col = get_column_info(ctl, i);
|
2020-02-08 10:00:20 -06:00
|
|
|
int flags = col->flags;
|
|
|
|
struct libscols_column *cl;
|
|
|
|
|
|
|
|
cl = scols_table_new_column(ctl->table, col->name, col->whint, flags);
|
|
|
|
if (cl == NULL) {
|
|
|
|
warnx(_("failed to initialize output column"));
|
|
|
|
goto err;
|
|
|
|
}
|
|
|
|
if (ctl->json)
|
|
|
|
scols_column_set_json_type(cl, col->json_type);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
err:
|
|
|
|
scols_unref_table(ctl->table);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2020-02-24 12:26:38 -06:00
|
|
|
static char *remove_repeated_spaces(char *const str)
|
2020-02-08 10:00:20 -06:00
|
|
|
{
|
|
|
|
char *inp = str, *outp = str;
|
|
|
|
uint8_t prev_space = 0;
|
|
|
|
|
|
|
|
while (*inp) {
|
|
|
|
if (isspace(*inp)) {
|
|
|
|
if (!prev_space) {
|
|
|
|
*outp++ = ' ';
|
|
|
|
prev_space = 1;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
*outp++ = *inp;
|
|
|
|
prev_space = 0;
|
|
|
|
}
|
|
|
|
++inp;
|
|
|
|
}
|
|
|
|
*outp = '\0';
|
|
|
|
return str;
|
|
|
|
}
|
|
|
|
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
/*
|
|
|
|
* irqinfo - parse the system's interrupts
|
|
|
|
*/
|
2020-02-23 01:39:11 -06:00
|
|
|
static struct irq_stat *get_irqinfo(void)
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
{
|
|
|
|
FILE *irqfile;
|
2020-02-23 01:39:11 -06:00
|
|
|
char *line = NULL, *tmp;
|
|
|
|
size_t len = 0;
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
struct irq_stat *stat;
|
|
|
|
struct irq_info *curr;
|
|
|
|
|
2020-02-22 09:19:09 -06:00
|
|
|
/* NAME + ':' + 11 bytes/cpu + IRQ_NAME_LEN */
|
2020-01-04 01:40:49 -06:00
|
|
|
stat = xcalloc(1, sizeof(*stat));
|
2020-01-03 15:06:43 -06:00
|
|
|
|
2020-01-04 01:40:49 -06:00
|
|
|
stat->irq_info = xmalloc(sizeof(*stat->irq_info) * IRQ_INFO_LEN);
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
stat->nr_irq_info = IRQ_INFO_LEN;
|
|
|
|
|
2020-01-03 15:06:43 -06:00
|
|
|
irqfile = fopen(_PATH_PROC_INTERRUPTS, "r");
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
if (!irqfile) {
|
2020-01-03 15:06:43 -06:00
|
|
|
warn(_("cannot open %s"), _PATH_PROC_INTERRUPTS);
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
goto free_stat;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* read header firstly */
|
2020-02-23 01:39:11 -06:00
|
|
|
if (getline(&line, &len, irqfile) < 0) {
|
2020-01-03 15:06:43 -06:00
|
|
|
warn(_("cannot read %s"), _PATH_PROC_INTERRUPTS);
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
goto close_file;
|
|
|
|
}
|
|
|
|
|
2020-02-23 01:39:11 -06:00
|
|
|
tmp = line;
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
while ((tmp = strstr(tmp, "CPU")) != NULL) {
|
|
|
|
tmp += 3; /* skip this "CPU", find next */
|
|
|
|
stat->nr_active_cpu++;
|
|
|
|
}
|
|
|
|
|
2020-01-03 15:06:43 -06:00
|
|
|
/* parse each line of _PATH_PROC_INTERRUPTS */
|
2020-02-23 01:39:11 -06:00
|
|
|
while (getline(&line, &len, irqfile) >= 0) {
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
unsigned long count;
|
|
|
|
int index, length;
|
|
|
|
|
2020-02-23 01:39:11 -06:00
|
|
|
tmp = strchr(line, ':');
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
if (!tmp)
|
|
|
|
continue;
|
|
|
|
|
2020-02-23 01:39:11 -06:00
|
|
|
length = strlen(line);
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
|
|
|
|
curr = stat->irq_info + stat->nr_irq++;
|
2020-01-04 01:40:49 -06:00
|
|
|
memset(curr, 0, sizeof(*curr));
|
2020-02-23 01:39:11 -06:00
|
|
|
*tmp = '\0';
|
|
|
|
curr->irq = xstrdup(line);
|
2020-02-08 10:00:20 -06:00
|
|
|
ltrim_whitespace((unsigned char *)curr->irq);
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
|
|
|
|
tmp += 1;
|
2020-02-23 01:39:11 -06:00
|
|
|
for (index = 0; (index < stat->nr_active_cpu) && (tmp - line < length); index++) {
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
sscanf(tmp, " %10lu", &count);
|
2020-02-22 10:42:56 -06:00
|
|
|
curr->total += count;
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
stat->total_irq += count;
|
|
|
|
tmp += 11;
|
|
|
|
}
|
|
|
|
|
2020-02-23 01:39:11 -06:00
|
|
|
if (tmp - line < length) {
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
/* strip all space before desc */
|
2020-02-08 10:00:20 -06:00
|
|
|
while (isspace(*tmp))
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
tmp++;
|
2020-02-08 10:00:20 -06:00
|
|
|
tmp = remove_repeated_spaces(tmp);
|
2020-02-23 01:39:11 -06:00
|
|
|
curr->name = xstrdup(tmp);
|
2020-02-24 12:26:38 -06:00
|
|
|
} else /* no irq name string, we have to set '\0' here */
|
2020-02-23 01:39:11 -06:00
|
|
|
curr->name = xstrdup("");
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
|
|
|
|
if (stat->nr_irq == stat->nr_irq_info) {
|
|
|
|
stat->nr_irq_info *= 2;
|
2020-01-04 01:40:49 -06:00
|
|
|
stat->irq_info = xrealloc(stat->irq_info,
|
|
|
|
sizeof(*stat->irq_info) * stat->nr_irq_info);
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
}
|
|
|
|
}
|
2020-01-04 03:35:19 -06:00
|
|
|
fclose(irqfile);
|
2020-02-23 01:39:11 -06:00
|
|
|
free(line);
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
return stat;
|
|
|
|
|
2020-01-03 15:06:43 -06:00
|
|
|
close_file:
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
fclose(irqfile);
|
2020-01-03 15:06:43 -06:00
|
|
|
free_stat:
|
2020-01-04 01:40:49 -06:00
|
|
|
free(stat->irq_info);
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
free(stat);
|
2020-02-23 01:39:11 -06:00
|
|
|
free(line);
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2020-02-24 12:26:38 -06:00
|
|
|
static void free_irqinfo(struct irq_stat *const stat)
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
{
|
|
|
|
if (stat)
|
|
|
|
free(stat->irq_info);
|
|
|
|
free(stat);
|
|
|
|
}
|
|
|
|
|
2020-02-24 12:26:38 -06:00
|
|
|
static int sort_name(struct irq_info const *const a,
|
|
|
|
struct irq_info const *const b)
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
{
|
2020-02-22 10:42:56 -06:00
|
|
|
return (strcmp(a->name, b->name) > 0) ? 1 : 0;
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
}
|
|
|
|
|
2020-02-24 12:26:38 -06:00
|
|
|
static int sort_total(struct irq_info const *const a,
|
|
|
|
struct irq_info const *const b)
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
{
|
2020-02-22 10:42:56 -06:00
|
|
|
return a->total < b->total;
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
}
|
|
|
|
|
2020-02-24 12:26:38 -06:00
|
|
|
static int sort_delta(struct irq_info const *const a,
|
|
|
|
struct irq_info const *const b)
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
{
|
2020-02-22 10:42:56 -06:00
|
|
|
return a->delta < b->delta;
|
|
|
|
}
|
|
|
|
|
2020-02-24 12:26:38 -06:00
|
|
|
static int sort_interrupts(struct irq_info const *const a,
|
|
|
|
struct irq_info const *const b)
|
2020-02-22 10:42:56 -06:00
|
|
|
{
|
|
|
|
return (strcmp(a->irq, b->irq) > 0) ? 1 : 0;
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
}
|
|
|
|
|
2020-02-24 12:26:38 -06:00
|
|
|
static void sort_result(struct irqtop_ctl *const ctl,
|
|
|
|
struct irq_info *const result,
|
|
|
|
size_t const nmemb)
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
{
|
2020-01-04 02:08:17 -06:00
|
|
|
qsort(result, nmemb, sizeof(*result), (int (*)(const void *, const void *))ctl->sort_func);
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
}
|
|
|
|
|
2020-01-03 15:06:43 -06:00
|
|
|
static void __attribute__((__noreturn__)) usage(void)
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
{
|
2020-02-08 10:00:20 -06:00
|
|
|
size_t i;
|
|
|
|
|
2020-01-03 15:06:43 -06:00
|
|
|
fputs(USAGE_HEADER, stdout);
|
|
|
|
printf(_(" %s [options]\n"), program_invocation_short_name);
|
|
|
|
|
|
|
|
fputs(USAGE_SEPARATOR, stdout);
|
|
|
|
puts(_("Utility to display kernel interrupt information."));
|
|
|
|
|
|
|
|
fputs(USAGE_OPTIONS, stdout);
|
2020-02-08 10:00:20 -06:00
|
|
|
fputs(_(" -d, --delay <secs> delay updates\n"), stdout);
|
2020-02-24 12:26:38 -06:00
|
|
|
fputs(_(" -o, --once only display interrupts once, then exit\n"), stdout);
|
2020-02-08 10:00:20 -06:00
|
|
|
fputs(_(" --json output json, implies displaying once\n"), stdout);
|
|
|
|
fputs(_(" --columns <list> define which output columns to use (see below)\n"), stdout);
|
|
|
|
fputs(_(" -s, --sort <char> specify sort criteria by character (see below)\n"), stdout);
|
2020-01-03 15:06:43 -06:00
|
|
|
fputs(USAGE_SEPARATOR, stdout);
|
2020-02-24 12:26:38 -06:00
|
|
|
printf(USAGE_HELP_OPTIONS(22));
|
2020-02-08 10:00:20 -06:00
|
|
|
|
2020-02-24 12:26:38 -06:00
|
|
|
fputs(_("\nThe following interactive key commands are valid:\n"), stdout);
|
|
|
|
fputs(_(" i sort by IRQ\n"), stdout);
|
|
|
|
fputs(_(" t sort by TOTAL\n"), stdout);
|
|
|
|
fputs(_(" d sort by DELTA\n"), stdout);
|
|
|
|
fputs(_(" n sort by NAME\n"), stdout);
|
|
|
|
fputs(_(" q Q quit program\n"), stdout);
|
2020-02-08 10:00:20 -06:00
|
|
|
|
|
|
|
fputs(USAGE_COLUMNS, stdout);
|
|
|
|
for (i = 0; i < ARRAY_SIZE(infos); i++)
|
2020-02-24 12:26:38 -06:00
|
|
|
fprintf(stdout, " %-5s %s\n", infos[i].name, _(infos[i].help));
|
2020-02-08 10:00:20 -06:00
|
|
|
|
2020-01-03 15:06:43 -06:00
|
|
|
printf(USAGE_MAN_TAIL("irqtop(1)"));
|
|
|
|
exit(EXIT_SUCCESS);
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
}
|
|
|
|
|
2020-02-24 12:26:38 -06:00
|
|
|
|
|
|
|
static sort_fp *set_sort_func(char const key)
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
{
|
|
|
|
switch (key) {
|
|
|
|
case 'i':
|
2020-02-24 12:26:38 -06:00
|
|
|
return sort_interrupts;
|
2020-02-22 10:42:56 -06:00
|
|
|
case 't':
|
2020-02-24 12:26:38 -06:00
|
|
|
return sort_total;
|
2020-02-22 10:42:56 -06:00
|
|
|
case 'd':
|
2020-02-24 12:26:38 -06:00
|
|
|
return sort_delta;
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
case 'n':
|
2020-02-24 12:26:38 -06:00
|
|
|
return sort_name;
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
default:
|
2020-02-24 12:26:38 -06:00
|
|
|
return DEF_SORT_FUNC;
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-24 12:26:38 -06:00
|
|
|
static void parse_input(struct irqtop_ctl *const ctl, char const c)
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
{
|
2020-01-03 15:06:43 -06:00
|
|
|
switch (c) {
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
case 'i':
|
2020-01-04 02:08:17 -06:00
|
|
|
ctl->sort_func = sort_interrupts;
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
break;
|
2020-02-22 10:42:56 -06:00
|
|
|
case 't':
|
|
|
|
ctl->sort_func = sort_total;
|
|
|
|
break;
|
|
|
|
case 'd':
|
|
|
|
ctl->sort_func = sort_delta;
|
|
|
|
break;
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
case 'n':
|
2020-01-04 02:08:17 -06:00
|
|
|
ctl->sort_func = sort_name;
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
break;
|
|
|
|
case 'q':
|
|
|
|
case 'Q':
|
2020-01-04 02:32:42 -06:00
|
|
|
ctl->request_exit = 1;
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-02-24 12:26:38 -06:00
|
|
|
static inline void print_line(struct irqtop_ctl const *const ctl,
|
|
|
|
char const *const fmt, ...)
|
2020-01-04 01:33:01 -06:00
|
|
|
{
|
|
|
|
va_list args;
|
|
|
|
|
|
|
|
va_start(args, fmt);
|
2020-01-04 02:08:17 -06:00
|
|
|
if (ctl->run_once)
|
2020-01-04 01:33:01 -06:00
|
|
|
vprintf(fmt, args);
|
2020-02-24 12:26:38 -06:00
|
|
|
else
|
2020-01-04 02:08:17 -06:00
|
|
|
vw_printw(ctl->win, fmt, args);
|
2020-01-04 01:33:01 -06:00
|
|
|
va_end(args);
|
|
|
|
}
|
|
|
|
|
2020-02-24 12:26:38 -06:00
|
|
|
static int update_screen(struct irqtop_ctl *const ctl)
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
{
|
2020-01-05 03:00:28 -06:00
|
|
|
struct irq_info *result, *curr;
|
|
|
|
struct irq_stat *stat;
|
|
|
|
size_t size;
|
|
|
|
size_t index;
|
2020-01-05 04:40:12 -06:00
|
|
|
time_t now;
|
|
|
|
char timestr[64];
|
2020-01-05 03:00:28 -06:00
|
|
|
|
2020-02-22 08:48:55 -06:00
|
|
|
/* the stats */
|
2020-02-23 01:39:11 -06:00
|
|
|
stat = get_irqinfo();
|
2020-01-05 03:00:28 -06:00
|
|
|
if (!stat) {
|
|
|
|
ctl->request_exit = 1;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!ctl->run_once && ctl->old_rows != ctl->rows) {
|
|
|
|
resizeterm(ctl->rows, ctl->cols);
|
|
|
|
ctl->old_rows = ctl->rows;
|
|
|
|
}
|
2020-02-08 10:00:20 -06:00
|
|
|
if (init_scols_table(ctl))
|
|
|
|
return 1;
|
2020-01-05 03:00:28 -06:00
|
|
|
|
|
|
|
size = sizeof(*stat->irq_info) * stat->nr_irq;
|
|
|
|
result = xmalloc(size);
|
|
|
|
memcpy(result, stat->irq_info, size);
|
2020-02-22 10:42:56 -06:00
|
|
|
if (ctl->prev_stat) {
|
|
|
|
stat->delta_irq = 0;
|
2020-02-22 08:48:55 -06:00
|
|
|
for (index = 0; index < stat->nr_irq; index++) {
|
2020-02-24 12:26:38 -06:00
|
|
|
result[index].delta = result[index].total -
|
|
|
|
ctl->prev_stat->irq_info[index].total;
|
2020-02-22 10:42:56 -06:00
|
|
|
stat->delta_irq += result[index].delta;
|
2020-02-22 08:48:55 -06:00
|
|
|
}
|
2020-02-21 16:28:43 -06:00
|
|
|
}
|
2020-01-05 03:00:28 -06:00
|
|
|
sort_result(ctl, result, stat->nr_irq);
|
2020-02-22 08:48:55 -06:00
|
|
|
for (index = 0; index < stat->nr_irq; index++) {
|
2020-01-05 03:00:28 -06:00
|
|
|
curr = result + index;
|
2020-02-08 10:00:20 -06:00
|
|
|
add_scols_line(ctl, curr);
|
2020-01-05 03:00:28 -06:00
|
|
|
}
|
|
|
|
free(result);
|
|
|
|
|
2020-02-22 08:48:55 -06:00
|
|
|
/* header */
|
|
|
|
if (!ctl->run_once)
|
|
|
|
move(0, 0);
|
|
|
|
if (!ctl->json) {
|
|
|
|
now = time(NULL);
|
2020-03-04 07:17:27 -06:00
|
|
|
strtime_iso(&now, ISO_TIMESTAMP, timestr, sizeof(timestr));
|
|
|
|
print_line(ctl, _("irqtop | total: %ld delta: %ld | %s | %s\n\n"),
|
2020-02-22 10:42:56 -06:00
|
|
|
stat->total_irq, stat->delta_irq, ctl->hostname, timestr);
|
2020-02-22 08:48:55 -06:00
|
|
|
}
|
|
|
|
/* body */
|
2020-02-08 10:00:20 -06:00
|
|
|
if (ctl->run_once)
|
|
|
|
scols_print_table(ctl->table);
|
|
|
|
else {
|
|
|
|
char *data;
|
|
|
|
|
|
|
|
scols_print_table_to_string(ctl->table, &data);
|
|
|
|
print_line(ctl, "%s", data);
|
|
|
|
free(data);
|
|
|
|
}
|
2020-02-22 08:48:55 -06:00
|
|
|
/* clean up */
|
2020-02-08 10:00:20 -06:00
|
|
|
scols_unref_table(ctl->table);
|
2020-02-22 10:42:56 -06:00
|
|
|
if (ctl->prev_stat)
|
|
|
|
free_irqinfo(ctl->prev_stat);
|
|
|
|
ctl->prev_stat = stat;
|
2020-01-05 03:00:28 -06:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2020-02-24 12:26:38 -06:00
|
|
|
static int event_loop(struct irqtop_ctl *const ctl)
|
2020-01-05 03:27:19 -06:00
|
|
|
{
|
|
|
|
int efd, sfd, tfd;
|
|
|
|
sigset_t sigmask;
|
|
|
|
struct signalfd_siginfo siginfo;
|
|
|
|
struct epoll_event ev, events[MAX_EVENTS];
|
|
|
|
long int nr;
|
|
|
|
uint64_t unused;
|
|
|
|
int retval = 0;
|
|
|
|
|
|
|
|
efd = epoll_create1(0);
|
|
|
|
|
|
|
|
if ((tfd = timerfd_create(CLOCK_MONOTONIC, 0)) < 0)
|
|
|
|
err(EXIT_FAILURE, _("cannot not create timerfd"));
|
|
|
|
if (timerfd_settime(tfd, 0, &ctl->timer, NULL) != 0)
|
|
|
|
err(EXIT_FAILURE, _("cannot set timerfd"));
|
|
|
|
ev.events = EPOLLIN;
|
|
|
|
ev.data.fd = tfd;
|
|
|
|
if (epoll_ctl(efd, EPOLL_CTL_ADD, tfd, &ev) != 0)
|
|
|
|
err(EXIT_FAILURE, _("epoll_ctl failed"));
|
|
|
|
|
|
|
|
if (sigfillset(&sigmask) != 0)
|
|
|
|
err(EXIT_FAILURE, _("sigfillset failed"));
|
|
|
|
if (sigprocmask(SIG_BLOCK, &sigmask, NULL) != 0)
|
|
|
|
err(EXIT_FAILURE, _("sigprocmask failed"));
|
|
|
|
if ((sfd = signalfd(-1, &sigmask, 0)) < 0)
|
|
|
|
err(EXIT_FAILURE, _("cannot not create signalfd"));
|
|
|
|
ev.events = EPOLLIN;
|
|
|
|
ev.data.fd = sfd;
|
|
|
|
if (epoll_ctl(efd, EPOLL_CTL_ADD, sfd, &ev) != 0)
|
|
|
|
err(EXIT_FAILURE, _("epoll_ctl failed"));
|
|
|
|
|
|
|
|
ev.events = EPOLLIN;
|
|
|
|
ev.data.fd = STDIN_FILENO;
|
|
|
|
if (epoll_ctl(efd, EPOLL_CTL_ADD, STDIN_FILENO, &ev) != 0)
|
|
|
|
err(EXIT_FAILURE, _("epoll_ctl failed"));
|
|
|
|
|
|
|
|
retval |= update_screen(ctl);
|
|
|
|
refresh();
|
|
|
|
|
|
|
|
while (!ctl->request_exit) {
|
|
|
|
const ssize_t nr_events = epoll_wait(efd, events, MAX_EVENTS, -1);
|
|
|
|
|
|
|
|
for (nr = 0; nr < nr_events; nr++) {
|
|
|
|
if (events[nr].data.fd == tfd) {
|
|
|
|
if (read(tfd, &unused, sizeof(unused)) < 0)
|
|
|
|
warn(_("read failed"));
|
|
|
|
} else if (events[nr].data.fd == sfd) {
|
|
|
|
if (read(sfd, &siginfo, sizeof(siginfo)) < 0) {
|
|
|
|
warn(_("read failed"));
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (siginfo.ssi_signo == SIGWINCH)
|
|
|
|
get_terminal_dimension(&ctl->cols, &ctl->rows);
|
|
|
|
else {
|
|
|
|
ctl->request_exit = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else if (events[nr].data.fd == STDIN_FILENO) {
|
|
|
|
char c;
|
|
|
|
|
|
|
|
if (read(STDIN_FILENO, &c, 1) != 1)
|
|
|
|
warn(_("read failed"));
|
|
|
|
parse_input(ctl, c);
|
|
|
|
} else
|
|
|
|
abort();
|
|
|
|
retval |= update_screen(ctl);
|
|
|
|
refresh();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
2020-02-24 12:26:38 -06:00
|
|
|
static void parse_args(struct irqtop_ctl *const ctl, int const argc,
|
|
|
|
char *const *const argv)
|
2020-01-05 03:00:28 -06:00
|
|
|
{
|
2020-02-08 10:00:20 -06:00
|
|
|
enum {
|
2020-02-24 12:26:38 -06:00
|
|
|
COLUMNS_OPT = CHAR_MAX + 1,
|
2020-02-08 10:00:20 -06:00
|
|
|
JSON_OPT,
|
|
|
|
};
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
static const struct option longopts[] = {
|
2020-01-03 15:06:43 -06:00
|
|
|
{"delay", required_argument, NULL, 'd'},
|
|
|
|
{"sort", required_argument, NULL, 's'},
|
|
|
|
{"once", no_argument, NULL, 'o'},
|
2020-02-08 10:00:20 -06:00
|
|
|
{"json", no_argument, NULL, JSON_OPT},
|
2020-02-22 10:42:56 -06:00
|
|
|
{"columns", required_argument, NULL, COLUMNS_OPT},
|
2020-01-03 15:06:43 -06:00
|
|
|
{"help", no_argument, NULL, 'h'},
|
|
|
|
{"version", no_argument, NULL, 'V'},
|
|
|
|
{NULL, 0, NULL, 0}
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
};
|
2020-01-05 03:00:28 -06:00
|
|
|
int o;
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
|
|
|
|
while ((o = getopt_long(argc, argv, "d:os:hV", longopts, NULL)) != -1) {
|
|
|
|
switch (o) {
|
|
|
|
case 'd':
|
2020-01-05 03:27:19 -06:00
|
|
|
{
|
|
|
|
struct timeval delay;
|
|
|
|
|
|
|
|
strtotimeval_or_err(optarg, &delay,
|
|
|
|
_("failed to parse delay argument"));
|
|
|
|
TIMEVAL_TO_TIMESPEC(&delay, &ctl->timer.it_interval);
|
|
|
|
ctl->timer.it_value = ctl->timer.it_interval;
|
|
|
|
}
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
break;
|
|
|
|
case 's':
|
2020-02-24 12:26:38 -06:00
|
|
|
ctl->sort_func = set_sort_func(optarg[0]);
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
break;
|
|
|
|
case 'o':
|
2020-01-05 03:00:28 -06:00
|
|
|
ctl->run_once = 1;
|
|
|
|
ctl->request_exit = 1;
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
break;
|
2020-02-08 10:00:20 -06:00
|
|
|
case JSON_OPT:
|
|
|
|
ctl->json = 1;
|
|
|
|
ctl->run_once = 1;
|
|
|
|
ctl->request_exit = 1;
|
|
|
|
break;
|
|
|
|
case COLUMNS_OPT:
|
2020-02-22 10:42:56 -06:00
|
|
|
ctl->specific_columns = 1;
|
2020-02-08 10:00:20 -06:00
|
|
|
if (optarg) {
|
|
|
|
ssize_t nc = string_to_idarray(optarg, ctl->columns,
|
|
|
|
ARRAY_SIZE(ctl->columns),
|
|
|
|
column_name_to_id);
|
|
|
|
|
|
|
|
if (nc < 0)
|
2020-02-22 10:42:56 -06:00
|
|
|
errx(EXIT_FAILURE,
|
|
|
|
_("too many or unknown --columns argument: %s"),
|
|
|
|
optarg);
|
2020-02-08 10:00:20 -06:00
|
|
|
ctl->ncolumns = nc;
|
|
|
|
}
|
|
|
|
break;
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
case 'V':
|
2020-01-03 15:06:43 -06:00
|
|
|
print_version(EXIT_SUCCESS);
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
case 'h':
|
2020-01-03 15:06:43 -06:00
|
|
|
usage();
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
default:
|
2020-01-05 03:00:28 -06:00
|
|
|
errtryhelp(EXIT_FAILURE);
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
}
|
|
|
|
}
|
2020-01-05 03:00:28 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
int main(int argc, char **argv)
|
|
|
|
{
|
|
|
|
int is_tty;
|
|
|
|
int retval = EXIT_SUCCESS;
|
|
|
|
struct termios saved_tty;
|
2020-01-05 03:27:19 -06:00
|
|
|
struct irqtop_ctl ctl = {
|
|
|
|
.timer.it_interval = {3, 0},
|
|
|
|
.timer.it_value = {3, 0}
|
|
|
|
};
|
2020-01-05 03:00:28 -06:00
|
|
|
|
|
|
|
setlocale(LC_ALL, "");
|
|
|
|
ctl.sort_func = DEF_SORT_FUNC;
|
|
|
|
|
|
|
|
parse_args(&ctl, argc, argv);
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
|
2020-02-22 10:42:56 -06:00
|
|
|
if (!ctl.specific_columns) {
|
|
|
|
ctl.columns[ctl.ncolumns++] = COL_IRQ;
|
|
|
|
ctl.columns[ctl.ncolumns++] = COL_TOTAL;
|
|
|
|
if (!ctl.run_once)
|
|
|
|
ctl.columns[ctl.ncolumns++] = COL_DELTA;
|
|
|
|
ctl.columns[ctl.ncolumns++] = COL_NAME;
|
|
|
|
}
|
|
|
|
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
is_tty = isatty(STDIN_FILENO);
|
|
|
|
if (is_tty && tcgetattr(STDIN_FILENO, &saved_tty) == -1)
|
2020-01-03 15:06:43 -06:00
|
|
|
fputs(_("terminal setting retrieval"), stdout);
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
|
2020-01-05 03:00:28 -06:00
|
|
|
ctl.old_rows = ctl.rows;
|
2020-01-04 02:08:17 -06:00
|
|
|
get_terminal_dimension(&ctl.cols, &ctl.rows);
|
|
|
|
if (!ctl.run_once) {
|
|
|
|
ctl.win = initscr();
|
|
|
|
get_terminal_dimension(&ctl.cols, &ctl.rows);
|
|
|
|
resizeterm(ctl.rows, ctl.cols);
|
2020-02-22 02:12:59 -06:00
|
|
|
curs_set(0);
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
}
|
2020-01-04 02:08:17 -06:00
|
|
|
ctl.smp_num_cpus = sysconf(_SC_NPROCESSORS_ONLN);
|
2020-01-05 03:00:28 -06:00
|
|
|
gettime_monotonic(&ctl.uptime_tv);
|
2020-01-05 04:40:12 -06:00
|
|
|
ctl.hostname = xgethostname();
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
|
2020-01-05 03:27:19 -06:00
|
|
|
if (ctl.run_once)
|
|
|
|
retval = update_screen(&ctl);
|
|
|
|
else
|
|
|
|
event_loop(&ctl);
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
|
2020-02-21 16:28:43 -06:00
|
|
|
free_irqinfo(ctl.prev_stat);
|
2020-01-05 04:40:12 -06:00
|
|
|
free(ctl.hostname);
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
|
|
|
|
if (is_tty)
|
|
|
|
tcsetattr(STDIN_FILENO, TCSAFLUSH, &saved_tty);
|
|
|
|
|
2020-01-04 03:35:19 -06:00
|
|
|
if (ctl.win) {
|
|
|
|
delwin(ctl.win);
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
endwin();
|
2020-01-04 03:35:19 -06:00
|
|
|
}
|
irqtop: implement a new utility to display kernel interrupt
currently, there are usually 40/48/64/96 CPUs on a single server,
and a lot of interrupts are enabled by multi-queues of a NIC.
"/proc/interrupts" is not human readable any more.
'watch -d -n 1 "cat /proc/interrupts"' also can not work well.
so implement irqtop to show the interrupts information, we can
sort the interrupts by count(default), name and /proc/interrupts.
irqtop - IRQ : 49, TOTAL : 2361705032, CPU : 8, ACTIVE CPU : 8
IRQ COUNT DESC
CAL 21196 Function call interrupts
LOC 13733 Local timer interrupts
154 1430 IR-PCI-MSI 32768-edge i915
127 1322 IR-PCI-MSI 327680-edge xhci_hcd
RES 1224 Rescheduling interrupts
146 336 IR-PCI-MSI 520192-edge enp0s31f6
IWI 135 IRQ work interrupts
147 48 IR-PCI-MSI 31981569-edge nvme0q2
151 42 IR-PCI-MSI 31981573-edge nvme0q6
TLB 8 TLB shootdowns
150 7 IR-PCI-MSI 31981572-edge nvme0q5
152 5 IR-PCI-MSI 31981574-edge nvme0q7
156 4 IR-PCI-MSI 1572864-edge iwlwifi
148 3 IR-PCI-MSI 31981570-edge nvme0q3
153 2 IR-PCI-MSI 31981575-edge nvme0q8
NMI 2 Non-maskable interrupts
PMI 2 Performance monitoring interrupts
0 0 IR-IO-APIC 2-edge timer
1 0 IR-IO-APIC 1-edge i8042
8 0 IR-IO-APIC 8-edge rtc0
9 0 IR-IO-APIC 9-fasteoi acpi
12 0 IR-IO-APIC 12-edge i8042
test on 4.14 & 4.19, work fine. test on bare metal & kvm virtual
machine, work fine. hot-plug/hot-unplug virtual NIC during running
irqtop, work fine.
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2019-11-11 06:48:59 -06:00
|
|
|
return retval;
|
|
|
|
}
|