From e15dead20c76e9334d6d6dddfd9d7ef3c2647ece Mon Sep 17 00:00:00 2001 From: Juan Quintela Date: Mon, 5 Mar 2012 17:21:51 +0100 Subject: [PATCH 05/11] ram: calculate bwidth correctly RH-Author: Juan Quintela Message-id: <2112b56493184b395f772c05d6be8e6438852137.1330967827.git.quintela@redhat.com> Patchwork-id: 37964 O-Subject: [PATCH qemu-kvm RHEL-6.3 3/3] ram: calculate bwidth correctly Bugzilla: 752138 RH-Acked-by: Orit Wasserman RH-Acked-by: Markus Armbruster RH-Acked-by: Alex Williamson double d; int a, b, c; d = (a - b) / c; // integer division d = ((double)a - b)/ c; // double division. bwidth was being always 0 or 1, with this change it takes all values between. Signed-off-by: Juan Quintela --- vl.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) Signed-off-by: Michal Novotny --- vl.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/vl.c b/vl.c index 4b869e1..9ff9910 100644 --- a/vl.c +++ b/vl.c @@ -3000,7 +3000,7 @@ static int ram_save_live(Monitor *mon, QEMUFile *f, int stage, void *opaque) } t0 = get_clock() - t0; - bwidth = (bytes_transferred - bytes_transferred_last) / t0; + bwidth = ((double)bytes_transferred - bytes_transferred_last) / t0; /* if we haven't transferred anything this round, force expected_time to a * a very high value, but without crashing */ -- 1.7.7.6