From 7ccb93f111849e8542f4dab27a3d5a46db06b643 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 7b4db8c..399c61a 100755 --- a/prettyping +++ b/prettyping @@ -501,7 +501,7 @@ function print_global_stats(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, @@ -510,7 +510,7 @@ function print_global_stats(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, @@ -528,7 +528,7 @@ function print_recent_stats(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 )