Show standard deviation.
PR: bin/35433 Submitted by: Morten Rodal <morten@rodal.no>, Maxim Konovalov <maxim@macomnet.ru> MFC after: 1 week
This commit is contained in:
parent
d98b25897d
commit
ff42cf3e07
@ -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
|
||||
|
@ -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.
|
||||
|
@ -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",
|
||||
|
Loading…
x
Reference in New Issue
Block a user