Files
scst/scripts/monitor-interrupt-rate
Bart Van Assche c205138e87 scripts: Fix multiple shellcheck warnings
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8564 d57e44dd-8a1f-0410-8b47-8ef2f437770f
2019-08-25 22:51:57 +00:00

24 lines
400 B
Bash
Executable File

#!/bin/bash
interval="${1:-5}"
echo "Interrupts per second:"
while true
do
sum=0
while read -r line
do
for word in $line
do
if [ "${word#[0-9]}" != "$word" ] && [ "${word%[0-9]}" != "$word" ]; then
sum="$((sum + word))"
fi
done
done </proc/interrupts
if [ "$prev" != "" ]; then
echo $(((sum-prev)/interval))
fi
prev="$sum"
sleep "$interval"
done