Created
August 17, 2016 22:57
-
-
Save ffund/b4fb116094e4dcd3ec46af14648ba75e to your computer and use it in GitHub Desktop.
A bash script to monitor the queue on a network interface. See http://witestlab.poly.edu/~ffund/el7353/2-testbed-mm1.html for details.
This file contains hidden or 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 | |
if [ "$#" -ne 3 ]; then | |
echo "Usage: $0 interface duration interval" | |
echo "where 'interface' is the name of the interface on which the queue" | |
echo "running (e.g., eth2), 'duration' is the total runtime (in seconds)," | |
echo "and 'interval' is the time between measurements (in seconds)" | |
exit 1 | |
fi | |
interface=$1 | |
duration=$2 | |
interval=$3 | |
# Run for the number of seconds specified by the "duration" argument | |
end=$((SECONDS+$duration)) | |
while [ $SECONDS -lt $end ] | |
do | |
# print timestamp at the beginning of each line; | |
# useful for data analysis. (-n argument says not to | |
# create a newline after printing timestamp.) | |
echo -n "$(date +%s.%N) " | |
# Show current queue information on the specified | |
# interface, all on one line. | |
echo $(tc -p -s -d qdisc show dev $interface) | |
# sleep for the specified interval | |
sleep $interval | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment