Skip to content

Instantly share code, notes, and snippets.

@hgn
Last active March 26, 2018 08:39
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save hgn/e1f1ab9a3d03f8088624 to your computer and use it in GitHub Desktop.
Save hgn/e1f1ab9a3d03f8088624 to your computer and use it in GitHub Desktop.
Ping based RTT Measurement with Gnuplot for IPv4 and IPv6
ping heise.de -c 300 -ni 0.5 | awk -F '[= ]' {'print $(NF-1)'} | grep -E '[0-9]' > /tmp/ipv4.dat
ping6 heise.de -c 300 -ni 0.5 | awk -F '[= ]' {'print $(NF-1)'} | grep -E '[0-9]' > /tmp/ipv6.dat
cat << EOF > /tmp/ping-rtt.gpi
#!/usr/bin/gnuplot
set terminal svg size 1000,600 fname "Gill Sans" fsize 14 rounded dashed
set style line 80 lt 0
set style line 80 lt rgb "#808080"
set style line 81 lt 3
set style line 81 lt rgb "#808080" lw 0.5
set grid back linestyle 81
set border 3 back linestyle 80
set xtics nomirror
set ytics nomirror
set style line 1 lt 1
set style line 2 lt 1
set style line 3 lt 1
set style line 4 lt 1
set style line 1 lt rgb "#A00000" lw 2 pt 7
set style line 2 lt rgb "#00A000" lw 2 pt 9
set style line 3 lt rgb "#5060D0" lw 2 pt 5
set style line 4 lt rgb "#F25900" lw 2 pt 13
set output "ping-rtt.svg"
set xlabel "Ping [#]"
set ylabel "RTT [ms]"
set key bottom right
plot "/tmp/ipv4.dat" title "IPv4" ls 1, \
"/tmp/ipv6.dat" title "IPv6" ls 2
EOF
gnuplot /tmp/ping-rtt.gpi
inkscape --export-png=/tmp/ping-rtt.png ping-rtt.svg
feh -F /tmp/ping.png
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment