From the ping
manpage (emphasis mine):
When the specified number of packets have been sent (and received) or if the program is terminated with a SIGINT, a brief summary is displayed. Shorter current statistics can be obtained without termination of process with signal SIGQUIT.
So this will work if you're fine with your stats being slightly less verbose:
# the second part is only for showing you the PID
ping 8.8.8.8 & jobs ; fg
<... in another terminal ...>
kill -SIGQUIT $PID
Short statistics look like this:
19/19 packets, 0% loss, min/avg/ewma/max = 0.068/0.073/0.074/0.088 ms
The last value, labeled mdev
under Linux and stddev
under Solaris is computed slightly differently depending on these OSes.
The formula used by Linux ping is:
sqrt(smean-meanĀ²)
while the one used by Solaris ping is:
sqrt((smean-meanĀ²)*received/received-1)
with smean
being the mean of rtt
squares, mean
the mean of rtt
values and received
the number of answers received.
Here is a small awk
program using your data and showing how are computed these values.
echo "1.91 2.83 4.41 1.83 2.98 2.18 2.15 1.68 2.30 2.04 1.64 1.98 1.69 1.88
1.91 1.83 1.70 2.00 2.03 1.89 2.36 2.12 2.07 1.91 1.84 2.04 2.05 2.10 2.19
2.22 1.94 2.13 1.98 2.08 1.62 3.29 2.17 1.99 2.38 2.55 2.16 1.90 1.92 1.90
2.89 2.04 2.05 2.12 2.18 1.61 2.08 1.90 2.17 3.01 1.84 2.12 20.9 362 2.07
2.31 2.42 2.05 2.47 2.55 2.13 2.56 2.07 468 2.33 2.32 1.93 1.87 2.50 1.82
2.45 1.95" | awk '
function abs(v) {return v < 0 ? -v : v}
BEGIN {
min=0x7fffffff;
}
{
for(i=0;i<NF;i++) {
received++
v=$i
min=v<min?v:min;
max=v>max?v:max;
sum+=v
sum2+=v*v
}
}
END {
mean=sum/received
smean=sum2/received
printf("received=%d, min=%f, avg=%f, max=%f\n",received,min,sum/received,max)
printf("Linux ping mdev: %f\n", sqrt(smean-(mean*mean)))
printf("Solaris ping stddev: %f\n", sqrt(((smean-(mean*mean))*received)/(received-1)))
}
'
Its output is consistent with your test:
received=76, min=1.610000, avg=13.294211, max=468.000000
Linux ping mdev: 66.632781
Solaris ping stddev: 67.075529
Best Answer
The
time
statistic is the total time spent sending and receiving echo packets, including the delay between each packet: