[Spice-devel] [master PATCH 1/2] server: netstat: modify network bandwidth calculation

Alon Levy alevy at redhat.com
Tue Oct 18 11:03:14 PDT 2011


On Tue, Oct 18, 2011 at 07:20:14PM +0200, Uri Lublin wrote:
> Currently spice-server network bandwidth estimation is:
>   send an empty ping packet to the client (and ignore it) ("warmup")
>   send an empty ping packet and calculate time till pong is received ("latency")
>   send a ping packet with data (256KB) and calculate time till pong  ("roundtrip")
>   bandwidth = datasize / (roundtip - latency)
> 

ACK.

> Many times (e.g. fast LAN), "(roundtrip - latency)" is very small.
> This results with a falsely very high bandwidth.
> 
> This patch makes the bandwidth calculation be
>   bandwidth = datasize / roundtrip
> 
> Suggested by Marc-André Lureau <marcandre.lureau at redhat.com>
> ---
>  server/main_channel.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/server/main_channel.c b/server/main_channel.c
> index 43c0f3f..a4db724 100644
> --- a/server/main_channel.c
> +++ b/server/main_channel.c
> @@ -812,7 +812,7 @@ static int main_channel_handle_parsed(RedChannelClient *rcc, uint32_t size, uint
>                      break;
>                  }
>                  mcc->bitrate_per_sec = (uint64_t)(NET_TEST_BYTES * 8) * 1000000
> -                                        / (roundtrip - mcc->latency);
> +                                        / roundtrip;
>                  red_printf("net test: latency %f ms, bitrate %lu bps (%f Mbps)%s",
>                             (double)mcc->latency / 1000,
>                             mcc->bitrate_per_sec,
> -- 
> 1.7.6.4
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel


More information about the Spice-devel mailing list