# Ping's definition of mdev

Derek Burdick derek at burdick.cc
Thu Jun 16 23:06:00 MDT 2005

```I searched the man page and google but can not find a definition for
mdev, which is a returned statistic when ping exits.  Does anybody know
what it is measuring?  I have looked through the code and determined
mathematically what the algorithm does, but I don't see any relevance to
networking.  Does anybody have any insight?  I have attached my comments
on what the code is doing in case somebody knows of a generic use for
this algorithm.

Here is the sample output
3460 packets transmitted, 3451 received, 0% packet loss, time 119983ms
rtt min/avg/max/mdev = 303.108/305.426/347.859/2.979 ms, pipe 11

Here is what I believe ping_common.c is doing to determine mdev:

for each packet received and assuming tsum and tsum2 start at 0:
tsum += triptime
tsum2 += triptime * triptime

Once ping finishes
tsum /= nreceived + nrepeats // Get the average of the triptimes.  We
have 0 repeats so it has no effect here.
tsum2 /= nreceived + nrepeats // Get the average of the squared
triptimes.  Once again we have 0 repeats

tmdev = llsqrt(tsum2 - tsum * tsum); // Take the square root of the
difference of the average squared triptimes and the average triptime
squared.

tmdev is then printed as printf("%ld.%03ld ms", tmdev /1000,
tmdev%1000);  //This is giving us the results in milliseconds

If anybody has any insight or comments i'd love to hear them.

Thanks,
Derek

p.s.  This is not a class assignment.  Our sales team wants to sell IP
phone service to a client in India using the Internet for the
bandwidth.  I was looking for any numbers I could find to help me give
them a good idea of what to expect.

I think I will add a Jitter calculation in to ping as that is usually a
great indication along with packet loss on what to expect with VOIP.

Thanks again.

```