Skip to content

Instantly share code, notes, and snippets.

Created August 13, 2014 17:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/6f7d887c5eaf9597a6b5 to your computer and use it in GitHub Desktop.
Save anonymous/6f7d887c5eaf9597a6b5 to your computer and use it in GitHub Desktop.
#!/bin/sh
netperf_tcp=0
netperf_udp=0
if [ $# -eq 1 ]
then
time=30
msg_size=16384
netperf_tcp=$(netperf -4 -H $1 -l ${time} -t TCP_STREAM -T0,1 -- -m ${msg_size} | grep "$msg_size"| awk '{print $5}'| sed -e 's/ /,/g')
netperf_udp=$(netperf -4 -H $1 -l ${time} -t UDP_STREAM -T0,1 -- -m ${msg_size} | grep "$msg_size"| awk '{print $6}'| sed -e 's/ /,/g')
echo "{
\"tcp_throughput\": $netperf_tcp,
\"udp_throughput\": $netperf_udp
}"
else
netserver > /dev/null 2>&1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment