Skip to content

Instantly share code, notes, and snippets.

@neomantra
Created August 22, 2013 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neomantra/6307905 to your computer and use it in GitHub Desktop.
Save neomantra/6307905 to your computer and use it in GitHub Desktop.
Scans for smp affinity for the interrupts on the passed interfaces.
#!/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