summaryrefslogtreecommitdiffstats
path: root/sbin/ping6/ping6.c
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/ping6.c
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/ping6.c')
-rw-r--r--sbin/ping6/ping6.c8
1 files changed, 4 insertions, 4 deletions
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