Artificial intelligent assistant

What is the difference between /proc/interrupts and /proc/softirq in Linux? `/proc/softirq` is softirq stats. Is `/proc/interrupt` both hard and soft interrupts or hard only? I want to measure the rate of hard and soft irq's per second roughly using `watch -n 1 grep 'foo' /proc/softirq` and `watch -n 1 grep 'bar' /proc/interrupt` so I can compare the rate of hardware interrupt increase to software interrupt. I'm wondering if I need to subtract `/proc/softirq` counts from `/proc/interrupt` to get the count of hardware IRQs because it counts both kinds or if `/proc/interrupt` is hardware only?

softirqs aren't directly related to hardware interrupts, they're the successor to "bottom halves" and the predecessor of tasklets. The (old) Unreliable Guide to Hacking the Linux Kernel has a brief section on the topic; I dare say there are better resources elsewhere. The list of softirqs is defined in `include/linux/interrupt.h`; you'll see they don't correspond to single hardware interrupts.

Thus you shouldn't subtract `/proc/softirq` counts from `/proc/interrupts`. The latter only counts hardware interrupts; these of course may result in softirqs being used too, but there's no easy way of determining the correlation ( _e.g._ between hardware interrupts on your network adapter and `NET_RX` or `NET_TX` softirqs).

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy bf5bcbb42271224087102611da812321