aboutsummaryrefslogtreecommitdiff
path: root/migration
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 /migration
parent4e39f57c0010b689ffa15658ff063006b45309db (diff)
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>
Diffstat (limited to 'migration')
-rw-r--r--migration/migration.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/migration/migration.c b/migration/migration.c
index 1a42aee412..adc6b6f1c9 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) /