Created
August 22, 2013 14:27
-
-
Save neomantra/6307905 to your computer and use it in GitHub Desktop.
Scans for smp affinity for the interrupts on the passed interfaces.
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/bash | |
usage() | |
{ | |
cat >&2 <<EOF | |
usage: $0 [-h] iface [iface2 [...]] | |
Scans for smp affinity for the interrupts on the passed interfaces. | |
Must be run as root. | |
Example: $0 eth4 eth5 | |
EOF | |
} | |
while getopts "h?" opt ; do | |
case "$opt" in | |
h) usage ; exit ;; | |
[?]) usage ; exit ;; | |
esac | |
done | |
# Needs interface arguments | |
if (($# == 0)) ; then | |
usage | |
exit 1 | |
fi | |
# Make sure only root can run our script | |
if [ "$(id -u)" != "0" ]; then | |
echo "This script must be run as root" 1>&2 | |
exit 1 | |
fi | |
# Do the work | |
for eth in "$@" ; do | |
eth_interrupts=$(grep $eth /proc/interrupts | tr ':' ' ' | awk '{print $1}') | |
for int in $eth_interrupts ; do | |
echo -n "$eth $int " | |
cat /proc/irq/$int/smp_affinity | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment