commit a0be8cd2d26f5226feec1f8a51363af11e841b45
parent 8cb62c2dd61a8bb65af1e3af27980f4a0256234b
Author: CNLohr <charles@cnlohr.com>
Date: Sun, 27 Nov 2016 14:46:44 -0500
Merge pull request #13 from donat-b/packet_loss
Added packet loss
Diffstat:
1 file changed, 3 insertions(+), 0 deletions(-)
diff --git a/cnping.c b/cnping.c
@@ -130,6 +130,7 @@ void DrawFrame( void )
double maxtime = 0;
double stddev = 0;
double last = -1;
+ double loss = 100.00;
for( i = 0; i < screenx; i++ )
{
@@ -171,6 +172,7 @@ void DrawFrame( void )
}
double avg = totaltime / totalcountok;
+ loss = (double) (screenx - totalcountok) / screenx * 100;
for( i = 0; i < screenx; i++ )
{
@@ -211,6 +213,7 @@ void DrawFrame( void )
sptr += sprintf( sptr, "Max : %5.2f ms\n", maxtime );
sptr += sprintf( sptr, "Avg : %5.2f ms\n", avg );
sptr += sprintf( sptr, "Std : %5.2f ms\n", stddev );
+ sptr += sprintf( sptr, "Loss: %5.2f %\n", loss );
CNFGColor( 0x00 );
for( x = -1; x < 2; x++ ) for( y = -1; y < 2; y++ )
{