This piece of code is originanly forked from :

Build Status

You can quickly evaluate the latency of your network and obtain mean, std, percentile, timeout data. Usage is python <ip> <n_sample> <timeout> for example you can run:

python 50 1300

and the output will be something like this:

mean latency: 19.0138426854 ms
std latency: 91.3184052069 ms
99% latency: 7.4905 ms
95% latency: 7.4905 ms
timeout: 0.2 %