Files
scst/scripts/runtime/monitor-interrupt-rate
Gleb Chesnokov 13839f3f6a scripts: Group runtime diagnostics and exercisers under runtime/
Place interrupt and memory monitors beside the block-device benchmark and
persistent-reservation exerciser. Update the SRPT maintainer instructions
and copyright paths with the move.

The four helpers are byte-for-byte unchanged, including their existing
privilege requirements and device or host side effects.
2026-10-19 10:31:32 +03:00

30 lines
562 B
Bash
Executable File

#!/bin/bash
interval="${1:-5}"
if ! [[ "$interval" =~ ^0*[1-9][0-9]*$ ]]; then
echo "Error: interval must be a positive integer." >&2
exit 1
fi
interval="${interval#"${interval%%[!0]*}"}"
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