Skip to content

Instantly share code, notes, and snippets.

@njam
Created July 5, 2016 09:04
Show Gist options
  • Save njam/b525989145d06f40df2c71ff171bd066 to your computer and use it in GitHub Desktop.
Save njam/b525989145d06f40df2c71ff171bd066 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