aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2015-01-26 12:12:27 +0100
committerJuan Quintela <quintela@redhat.com>2015-12-03 00:03:00 +0100
commita694ee343d13159d214823294bbda08e4bdac685 (patch)
treed40df1928925500bf4c999471e5ae46f55db488e
parent4e39f57c0010b689ffa15658ff063006b45309db (diff)
downloadqemu-a694ee343d13159d214823294bbda08e4bdac685.tar.gz
qemu-a694ee343d13159d214823294bbda08e4bdac685.tar.xz
qemu-a694ee343d13159d214823294bbda08e4bdac685.zip
migration: do floating-point division
Dividing integer expressions transferred_bytes and time_spent, and then converting the integer quotient to type double. Any remainder, or fractional part of the quotient, is ignored. Fix this. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
-rw-r--r--migration/migration.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/migration/migration.c b/migration/migration.c
index 1a42aee41..adc6b6f1c 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -1674,7 +1674,7 @@ static void *migration_thread(void *opaque)
if (current_time >= initial_time + BUFFER_DELAY) {
uint64_t transferred_bytes = qemu_ftell(s->file) - initial_bytes;
uint64_t time_spent = current_time - initial_time;
- double bandwidth = transferred_bytes / time_spent;
+ double bandwidth = (double)transferred_bytes / time_spent;
max_size = bandwidth * migrate_max_downtime() / 1000000;
s->mbps = time_spent ? (((double) transferred_bytes * 8.0) /