From d43f5cbd10912310b7b7a544a44409070267ecdd Mon Sep 17 00:00:00 2001 From: Xu Wang <59418106+xwang1498@users.noreply.github.com> Date: Wed, 25 Sep 2024 08:47:35 -0400 Subject: [PATCH] show packet loss in bps instead of whole percents --- prettyping | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/prettyping b/prettyping index cd93a24..9a4f086 100755 --- a/prettyping +++ b/prettyping @@ -488,7 +488,7 @@ function print_overall(percentage_lost, avg_rtt) { percentage_lost = ( lost+received > 0 ) ? (lost*100/(lost+received)) : 0 if ( '"${IS_TERMINAL}"' ) { - printf( "%2d/%3d (%2d%%) lost; %4.0f/" ESC_BOLD "%4.0f" ESC_DEFAULT "/%4.0fms; last: " ESC_BOLD "%4.0f" ESC_DEFAULT "ms", + printf( "%2d/%3d (%5.2f%%) lost; %4.0f/" ESC_BOLD "%4.0f" ESC_DEFAULT "/%4.0fms; last: " ESC_BOLD "%4.0f" ESC_DEFAULT "ms", lost, lost+received, percentage_lost, @@ -497,7 +497,7 @@ function print_overall(percentage_lost, avg_rtt) { max_rtt, last_rtt ) } else { - printf( "%2d/%3d (%2d%%) lost; %4.0f/" ESC_BOLD "%4.0f" ESC_DEFAULT "/%4.0fms", + printf( "%2d/%3d (%5.2f%%) lost; %4.0f/" ESC_BOLD "%4.0f" ESC_DEFAULT "/%4.0fms", lost, lost+received, percentage_lost, @@ -515,7 +515,7 @@ function print_last_n(i, percentage_lost, sum, min, avg, max, diffs) { sum += lastn_lost[i] } percentage_lost = (lastn_lost["size"] > 0) ? (sum*100/lastn_lost["size"]) : 0 - printf( "%2d/%3d (%2d%%) lost; ", + printf( "%2d/%3d (%5.2f%%) lost; ", sum, lastn_lost["size"], percentage_lost )