summaryrefslogtreecommitdiffstats
path: root/sbin/ping6
diff options
context:
space:
mode:
authorume <ume@FreeBSD.org>2002-03-01 09:49:48 +0000
committerume <ume@FreeBSD.org>2002-03-01 09:49:48 +0000
commitff42cf3e07ea977d1757a36f2930a66c3787a0f7 (patch)
treeff46525f4b1d86267c7311c838fde6a015fb7c51 /sbin/ping6
parentd98b25897dbc3fea0fc19d416aa4de57ce2417d2 (diff)
downloadFreeBSD-src-ff42cf3e07ea977d1757a36f2930a66c3787a0f7.zip
FreeBSD-src-ff42cf3e07ea977d1757a36f2930a66c3787a0f7.tar.gz
Show standard deviation.
PR: bin/35433 Submitted by: Morten Rodal <morten@rodal.no>, Maxim Konovalov <maxim@macomnet.ru> MFC after: 1 week
Diffstat (limited to 'sbin/ping6')
-rw-r--r--sbin/ping6/Makefile4
-rw-r--r--sbin/ping6/ping6.89
-rw-r--r--sbin/ping6/ping6.c8
3 files changed, 11 insertions, 10 deletions
diff --git a/sbin/ping6/Makefile b/sbin/ping6/Makefile
index c8ba599..98378fc 100644
--- a/sbin/ping6/Makefile
+++ b/sbin/ping6/Makefile
@@ -9,8 +9,8 @@ WARNS= 0
BINOWN= root
BINMODE=4555
-LDADD= -lipsec -lmd
-DPADD= ${LIBIPSEC} ${LIBMD}
+LDADD= -lipsec -lm -lmd
+DPADD= ${LIBIPSEC} ${LIBM} ${LIBMD}
# kame scopeid hack
CFLAGS+=-DKAME_SCOPEID
diff --git a/sbin/ping6/ping6.8 b/sbin/ping6/ping6.8
index 9e812a3..161f329 100644
--- a/sbin/ping6/ping6.8
+++ b/sbin/ping6/ping6.8
@@ -302,7 +302,8 @@ When the specified number of packets have been sent
or if the program is terminated with a
.Dv SIGINT ,
a brief summary is displayed, showing the number of packets sent and
-received, and the minimum, mean, and maximum of the round-trip times.
+received, and the minimum, mean, maximum, and standard deviation of
+the round-trip times.
.Pp
If
.Nm
@@ -313,9 +314,9 @@ receives a
argument for
.Xr stty 1 )
signal, the current number of packets sent and received, and the
-minimum, mean, and maximum of the round-trip times will be written to
-the standard output in the same format as the standard completion
-message.
+minimum, mean, maximum, and standard deviation of the round-trip times
+will be written to the standard output in the same format as the
+standard completion message.
.Pp
This program is intended for use in network testing, measurement and
management.
diff --git a/sbin/ping6/ping6.c b/sbin/ping6/ping6.c
index 4d28c4b..09152af 100644
--- a/sbin/ping6/ping6.c
+++ b/sbin/ping6/ping6.c
@@ -123,7 +123,7 @@ static const char rcsid[] =
#include <err.h>
#include <errno.h>
#include <fcntl.h>
-#if defined(__OpenBSD__) || defined(__NetBSD__)
+#if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__)
#include <math.h>
#endif
#include <signal.h>
@@ -233,7 +233,7 @@ int timing; /* flag to do timing */
double tmin = 999999999.0; /* minimum round trip time */
double tmax = 0.0; /* maximum round trip time */
double tsum = 0.0; /* sum of all times, for doing average */
-#if defined(__OpenBSD__) || defined(__NetBSD__)
+#if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__)
double tsumsq = 0.0; /* sum of all times squared, for std. dev. */
#endif
@@ -1433,7 +1433,7 @@ pr_pack(buf, cc, mhdr)
triptime = ((double)tv.tv_sec) * 1000.0 +
((double)tv.tv_usec) / 1000.0;
tsum += triptime;
-#if defined(__OpenBSD__) || defined(__NetBSD__)
+#if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__)
tsumsq += triptime * triptime;
#endif
if (triptime < tmin)
@@ -2180,7 +2180,7 @@ summary()
/* Only display average to microseconds */
double num = nreceived + nrepeats;
double avg = tsum / num;
-#if defined(__OpenBSD__) || defined(__NetBSD__)
+#if defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__)
double dev = sqrt(tsumsq / num - avg * avg);
(void)printf(
"round-trip min/avg/max/std-dev = %.3f/%.3f/%.3f/%.3f ms\n",
OpenPOWER on IntegriCloud