10

Is there something out there? Like top is for ps

maxschlepzig
  • 56,316
  • 50
  • 205
  • 279
lisak
  • 341
  • 1
  • 2
  • 11

8 Answers8

12
watch -n0.1 --no-title cat /proc/interrupts
lisak
  • 341
  • 1
  • 2
  • 11
10

dstat can also be used for that.

dstat -tif 60

To list all the interrupts (those with more than 10 in /proc/stat)

dstat -tf --int24 60

Same but using /proc/interrupts, so include things like LOC, PMI, RES...

You can also select the list of those you want:

$ dstat -t --int24 -I23,LOC,RES 5
----system---- ----interrupts---
     time     |  23   LOC   RES
21-12 16:30:23|   2   489    52
21-12 16:30:28|  30   593     6
21-12 16:30:30|  37   929     7

See also --top-int to track the most active interrupt:

$ dstat -t --top-int
----system---- ---most-frequent----
     time     |     interrupt
21-12 16:33:21|5242880-edge enp10s0  56
21-12 16:33:22|5242880-edge enp10s0  68
21-12 16:33:23|5242880-edge enp10s0   4
21-12 16:33:24|5242880-edge enp10s0   3
21-12 16:33:25|5242880-edge enp10s0  61
21-12 16:33:26|5242880-edge enp10s0  11
21-12 16:33:27|512000-edge ahci[0000:00:1f.2]   5
21-12 16:33:28|5242880-edge enp10s0  52
21-12 16:33:29|5242880-edge enp10s0  20
21-12 16:33:30|32768-edge i915  57
Stéphane Chazelas
  • 522,931
  • 91
  • 1,010
  • 1,501
4

mpstat(1) N M -I lets you do this with a specified polling interval and number of reports.

  • N is the polling interval, in seconds.
  • M is the number of times to report.
  • According to the man page, -I, which takes a number of options, is to "Report interrupts statistics".

Furthermore,

intr/s
Show the total number of interrupts received per second by the CPU or CPUs.
With the CPU keyword, the number of each individual interrupt received per second by the CPU or CPUs is displayed. Interrupts are those listed in /proc/interrupts file.

WAF
  • 362
  • 1
  • 5
  • 19
4

For a server with lot's of CPUs, I found https://github.com/lanceshelton/irqstat very useful. It shows where interrupts are happening in real time:

Sun Oct 21 20:16:09 2018
IRQs / 5 second(s)
IRQ#  TOTAL  NODE0   NODE1  NAME
  35  38060  38060       0  IR-PCI-MSI 2621440-edge enp5s0-rx-0
  36  19853  19853       0  IR-PCI-MSI 2621441-edge enp5s0-tx-0
  34    311    311       0  IR-PCI-MSI 512000-edge ahci[0000:00:1f.2]
  29    105    105       0  IR-PCI-MSI 2097152-edge enp4s0-rx-0
  42      0      0       0  IR-PCI-MSI 77824-edge ioat-msix
  43      0      0       0  IR-PCI-MSI 79872-edge ioat-msix
  49      0      0       0  IR-PCI-MSI 67180544-edge ioat-msix
  52      0      0       0  IR-PCI-MSI 67186688-edge ioat-msix
  53      0      0       0  IR-PCI-MSI 67188736-edge ioat-msix
  48      0      0       0  IR-PCI-MSI 67178496-edge ioat-msix
pva
  • 151
  • 2
0

Yes, there is irqtop which is part of not too old util-linux releases. For example, Fedora 33 is the first Fedora release that has it.

In the latest util-linux release, irqtop is also able to display softirqs (cf. --softirq).

Example:

$ irqtop -s delta
irqtop | total: 182243195 delta: 163991 | example.org | 2021-05-09 23:39:32+02:00

IRQ    TOTAL DELTA NAME
 63 14890381 35488 IR-PCI-MSI 3145728-edge eno3-TxRx-0
 64 14661318 34614 IR-PCI-MSI 3145729-edge eno3-TxRx-1
 58 29720656 23291 IR-PCI-MSI 2623488-edge eno2-TxRx-0
 61 29676645 23268 IR-PCI-MSI 2623491-edge eno2-TxRx-3
 60 29676091 23266 IR-PCI-MSI 2623490-edge eno2-TxRx-2
 59 29686036 23259 IR-PCI-MSI 2623489-edge eno2-TxRx-1
LOC  5524971   755 Local timer interrupts
 52    39316    14 IR-PCI-MSI 2621443-edge eno1-TxRx-3
CAL 12209964    12 Function call interrupts
 50    38809     6 IR-PCI-MSI 2621441-edge eno1-TxRx-1
 49    45351     4 IR-PCI-MSI 2621440-edge eno1-TxRx-0
 51    39170     2 IR-PCI-MSI 2621442-edge eno1-TxRx-2
maxschlepzig
  • 56,316
  • 50
  • 205
  • 279
  • Could not get this to work properly. There is a nasty unstable bug with ruby-curses that shoots a bunch of warnings all over the screen. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=958973 I am going to admit I could try to spend time fixing this but that involves setting up ruby / gem / other supported packages and env. Rather find a solution that is native to most linux systems. – Dave May 02 '22 at 13:49
  • @Dave You are trying to use the wrong `irqtop`! For comparison, on a Fedora 35 system: `rpm -qf $(which irqtop)` -> `util-linux-2.37.4-1.fc35.x86_64` and `file $(which irqtop)` -> `/usr/bin/irqtop: ELF 64-bit LSB pie executable [..]` IOW, try the `irqtopq` that is part of the util-linux package! – maxschlepzig May 03 '22 at 19:50
0

a bash quickie

A=/tmp/_1 ; B=/tmp/_2 ; 
while true ; do \
    cat /proc/interrupts > $A ; \
        diff -y $A $B | \
        head -n $((LINES-1)) | \
        sed "s|\(.*\)..[0-9A-Z]:.*|\1|" | \
        grep -C 99 --color "^.*|" ; \
    C=$A ; A=$B ; B=$C ;\
    sleep 1 ;\
done

explanation: with two temporary files, save the contents of /proc/interrupts to the first, show the differences between it the other (limited to 1 less than number of lines on the screen, and highlit with grep's coloring), switch the tmpfiles around, sleep a second, and repeat.

jmullee
  • 609
  • 3
  • 10
0

I am submitting my answer that does the following:

  • Uses native linux commands (cat, sed, grep , watch)
  • Does require installing rs (perform a sudo apt install rs before running the command below)
  • Supports many cpu nodes (this was the most important requirement)
  • Mainly used to grep what you want to display. In my case I needed only to see my network cards info:

Mainly I wanted to make all columns rows when performing a simple cat /proc/interrupts

watch -n1 -d "cat /proc/interrupts | grep 'CPU\|enp94s0f2v1' | sed -e '1 s/^/Irq_num /' | sed -e '1 s/$/Type Type_detail Thread/'  | sed 's/  */ /g' | sed 's/^ //g' | rs -c' ' -C' ' -T | column -t"

This will output and update with watch like the following:

Irq_num      457:                     458:                     459:                     460:
CPU0         2                        0                        0                        0
CPU1         0                        2                        0                        0
CPU2         0                        0                        2                        0
CPU3         0                        0                        0                        1
CPU4         221961382                0                        0                        0
CPU5         0                        0                        0                        0
CPU6         0                        212112424                0                        0
CPU7         0                        0                        0                        0
CPU8         0                        0                        0                        0
CPU9         0                        0                        0                        0
CPU10        0                        0                        0                        0
CPU11        0                        0                        0                        0
CPU12        0                        0                        0                        0
CPU13        0                        0                        0                        0
CPU14        0                        0                        0                        0
CPU15        0                        0                        0                        0
CPU16        0                        0                        0                        0
CPU17        0                        0                        0                        0
CPU18        0                        0                        0                        1244
CPU19        0                        0                        0                        0
CPU20        0                        0                        0                        0
CPU21        0                        0                        0                        0
CPU22        0                        0                        0                        0
CPU23        0                        0                        0                        0
CPU24        0                        0                        0                        0
CPU25        0                        0                        0                        0
CPU26        0                        0                        0                        0
CPU27        0                        0                        0                        0
CPU28        0                        0                        1170                     0
CPU29        0                        0                        0                        0
CPU30        0                        0                        0                        0
CPU31        0                        0                        0                        0
Type         IR-PCI-MSI               IR-PCI-MSI               IR-PCI-MSI               IR-PCI-MSI
Type_detail  49448961-edge            49448962-edge            49448963-edge            49448964-edge
Thread       iavf-enp94s0f2v1-TxRx-0  iavf-enp94s0f2v1-TxRx-1  iavf-enp94s0f2v1-TxRx-2  iavf-enp94s0f2v1-TxRx-3
Dave
  • 522
  • 4
  • 18
0

The newly developed utility pw ("Pipe Watch") can monitor anything that produces voluminous output, with useful interactive features such as triggering, filtering, split panes and more.

This video demonstrates pw being fed a continuous stream produced by cat /proc/interrupts in a shell while loop.

pw is about 2000 lines of code, in one file, with no dependencies other than POSIX C library functions. It has a detailed man page.

Kaz
  • 7,676
  • 1
  • 25
  • 46