diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2015-01-26 12:12:27 +0100 |
---|---|---|
committer | Juan Quintela <quintela@redhat.com> | 2015-12-03 00:03:00 +0100 |
commit | a694ee343d13159d214823294bbda08e4bdac685 (patch) | |
tree | d40df1928925500bf4c999471e5ae46f55db488e /migration/migration.c | |
parent | 4e39f57c0010b689ffa15658ff063006b45309db (diff) | |
download | qemu-a694ee343d13159d214823294bbda08e4bdac685.zip qemu-a694ee343d13159d214823294bbda08e4bdac685.tar.gz qemu-a694ee343d13159d214823294bbda08e4bdac685.tar.bz2 |
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/migration.c')
-rw-r--r-- | migration/migration.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/migration/migration.c b/migration/migration.c index 1a42aee..adc6b6f 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) / |