In the companion guide Linux Kernel Programming - Chapter 1, Kernel Workspace Setup, in the Modern tracing and performance analysis with [e]BPF section, we pointed out how the modern approach to tracing, performance measurement, and analysis on (recent 4.x) Linux is [e]BPF, the enhanced Berkeley Packet Filter (just called BPF as well). Among the plethora of tools it stocks (https://github.com/iovisor/bcc#tools), two suit our immediate purpose of tracing, measuring, and analyzing interrupts (both hardirqs and softirqs). (The tools are named toolname-bpfcc on Ubuntu, where toolname is the name of the tool in question, such as hardirqs-bpfcc and softirqs-bpfcc). These tools dynamically trace interrupts (at the time of writing, they're not based on kernel tracepoints yet). You will require root access to run these [e]BPF tools.
Measuring interrupts with [e]BPF
Important: You can install the BCC tools for your regular host...