This piece of code is originanly forked from : https://github.com/matthieu-lapeyre/network-benchmark
You can quickly evaluate the latency of your network and obtain mean, std, percentile, timeout data.
Usage is python network_test.py -i <ip> -s <n_sample> -t <timeout>
for example you can run:
python network_test.py -i 192.168.0.1 -s 50 -t 1300
and the output will be something like this:
mean latency: 19.0138426854 ms
std latency: 91.3184052069 ms
timeout: 0.2 %