mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-12-04 10:19:26 +00:00
Print packet loss figures with one decimal place. ping6 already does
this, and OpenBSD and NetBSD pings do it too. This is primarily useful for comparing low levels of packet loss.
This commit is contained in:
parent
3173042ecc
commit
aa822c3979
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=161273
@ -1356,7 +1356,7 @@ check_status()
|
||||
|
||||
if (siginfo_p) {
|
||||
siginfo_p = 0;
|
||||
(void)fprintf(stderr, "\r%ld/%ld packets received (%.0f%%)",
|
||||
(void)fprintf(stderr, "\r%ld/%ld packets received (%.1f%%)",
|
||||
nreceived, ntransmitted,
|
||||
ntransmitted ? nreceived * 100.0 / ntransmitted : 0.0);
|
||||
if (nreceived && timing)
|
||||
@ -1387,9 +1387,9 @@ finish()
|
||||
if (nreceived > ntransmitted)
|
||||
(void)printf("-- somebody's printing up packets!");
|
||||
else
|
||||
(void)printf("%d%% packet loss",
|
||||
(int)(((ntransmitted - nreceived) * 100) /
|
||||
ntransmitted));
|
||||
(void)printf("%.1f%% packet loss",
|
||||
((ntransmitted - nreceived) * 100.0) /
|
||||
ntransmitted);
|
||||
}
|
||||
if (nrcvtimeout)
|
||||
(void)printf(", %ld packets out of wait time", nrcvtimeout);
|
||||
|
Loading…
Reference in New Issue
Block a user