Skip to content

Instantly share code, notes, and snippets.

@Laxman-SM
Forked from njam/measure.sh
Created June 17, 2022 04:43
Show Gist options
  • Save Laxman-SM/7357f7942562471098d3e0d6942b26f1 to your computer and use it in GitHub Desktop.
Save Laxman-SM/7357f7942562471098d3e0d6942b26f1 to your computer and use it in GitHub Desktop.
Measure bandwidth with tcpstat + gnuplot
# Measure traffic with tcpstat
tcpstat -i em1 -o "%r\t%b\n" -s 30 0.1 > traffic.txt
# Create plot using the below script
gnuplot traffic.script > traffic.png
# Display plot
qlmanage -p 2>/dev/null traffic.png
set term png small
set grid
set yrange [ -10 : ]
set title "Traffic"
set xlabel "seconds"
set ylabel "bits/s"
plot "traffic.txt" using 1:2 smooth csplines title "Bandwidth"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment