Last active
July 26, 2018 13:49
-
-
Save rindeal/9807d8133ad25cd6a932 to your computer and use it in GitHub Desktop.
Pretty print /proc/interrupts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
sed -r -e 's/^ *//' -e 's/ {2,}/|/g' < /proc/interrupts | \ | |
awk -F'|' ' | |
BEGIN { cpu_n = 0; } | |
NR == 1 { | |
for(i = 1; i <= NF; i++) | |
if($i ~ CPU) | |
cpu_n++; | |
} | |
NR > 1 { | |
sum = 0; | |
for(i = 2; i <= cpu_n + 1; i++) | |
sum += $i; | |
printf("%4s %12d %-20s ", $1, sum, $6); | |
for(i = 1; i < 7; i++) | |
$i = ""; | |
print; | |
}' | \ | |
sort -nrk2 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment