[Spice-devel] [PATCH] server: net_test: put a limit on the calculated bitrate #698225

Hans de Goede hdegoede at redhat.com
Thu Oct 11 02:02:56 PDT 2012


ACK.

On 10/11/2012 10:50 AM, Uri Lublin wrote:
> When calculating bitrate of a local connection, the result can be too high.
> That happens when "roundtrip" and "latency" are very close, which only
> happens on fast networks. The decision that we are not in WAN network
> is correct, but the calculated number shown in the log message is not.
>
> This patch puts a limit to the bitrate, such that it does not change the
> decision but is an acceptable number to see in logs (specifically 10Gb).
> ---
>   server/main_channel.c |    3 +++
>   1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/server/main_channel.c b/server/main_channel.c
> index 0fd5ab6..80fbfb3 100644
> --- a/server/main_channel.c
> +++ b/server/main_channel.c
> @@ -52,6 +52,8 @@
>   #define NET_TEST_WARMUP_BYTES 0
>   #define NET_TEST_BYTES (1024 * 250)
>
> +#define NET_TEST_MAX_BITRATE ((uint64_t)10 * 1024 * 1024 * 1024)
> +
>   #define PING_INTERVAL (1000 * 10)
>
>   static uint8_t zero_page[ZERO_BUF_SIZE] = {0};
> @@ -971,6 +973,7 @@ static int main_channel_handle_parsed(RedChannelClient *rcc, uint32_t size, uint
>                   }
>                   mcc->bitrate_per_sec = (uint64_t)(NET_TEST_BYTES * 8) * 1000000
>                                           / (roundtrip - mcc->latency);
> +                mcc->bitrate_per_sec = MIN(mcc->bitrate_per_sec, NET_TEST_MAX_BITRATE);
>                   spice_printerr("net test: latency %f ms, bitrate %"PRIu64" bps (%f Mbps)%s",
>                              (double)mcc->latency / 1000,
>                              mcc->bitrate_per_sec,
>


More information about the Spice-devel mailing list