]> Git Repo - qemu.git/commitdiff
migration: fix xbzrle encoding rate calculation
authorWei Wang <[email protected]>
Wed, 17 Jun 2020 20:13:05 +0000 (13:13 -0700)
committerPeter Maydell <[email protected]>
Thu, 18 Jun 2020 09:26:02 +0000 (10:26 +0100)
It's reported an error of implicit conversion from "unsigned long" to
"double" when compiling with Clang 10. Simply make the encoding rate 0
when the encoded_size is 0.

Fixes: e460a4b1a4
Reviewed-by: Alex BennĂ©e <[email protected]>
Reviewed-by: Dr. David Alan Gilbert <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Reported-by: Richard Henderson <[email protected]>
Signed-off-by: Wei Wang <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
Message-id: 20200617201309.1640952[email protected]
Signed-off-by: Peter Maydell <[email protected]>
migration/ram.c

index 41cc530d9d6c0f30d3f051f60e377b2819426eb5..069b6e30bc22767d13cb330542c2401c95e54d1f 100644 (file)
@@ -913,10 +913,8 @@ static void migration_update_rates(RAMState *rs, int64_t end_time)
         unencoded_size = (xbzrle_counters.pages - rs->xbzrle_pages_prev) *
                          TARGET_PAGE_SIZE;
         encoded_size = xbzrle_counters.bytes - rs->xbzrle_bytes_prev;
-        if (xbzrle_counters.pages == rs->xbzrle_pages_prev) {
+        if (xbzrle_counters.pages == rs->xbzrle_pages_prev || !encoded_size) {
             xbzrle_counters.encoding_rate = 0;
-        } else if (!encoded_size) {
-            xbzrle_counters.encoding_rate = UINT64_MAX;
         } else {
             xbzrle_counters.encoding_rate = unencoded_size / encoded_size;
         }
This page took 0.025594 seconds and 4 git commands to generate.