From 6fffb6e5bc96e3a1f1db68f96d0acea9d41de83a Mon Sep 17 00:00:00 2001 From: Juan Quintela Date: Fri, 4 Feb 2011 12:20:00 -0200 Subject: [RHEL6 qemu-kvm PATCH 24/27] Count nanoseconds with uint64_t not doubles RH-Author: Juan Quintela Message-id: Patchwork-id: 17741 O-Subject: [PATCH 5/8] Count nanoseconds with uint64_t not doubles Bugzilla: 643970 RH-Acked-by: Alex Williamson RH-Acked-by: Jes Sorensen RH-Acked-by: Amit Shah Signed-off-by: Juan Quintela --- vl.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) Signed-off-by: Eduardo Habkost --- vl.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/vl.c b/vl.c index 96e052b..14c9e78 100644 --- a/vl.c +++ b/vl.c @@ -3345,6 +3345,7 @@ static int ram_save_live(Monitor *mon, QEMUFile *f, int stage, void *opaque) { ram_addr_t addr; uint64_t bytes_transferred_last; + uint64_t t0; double bwidth = 0; if (stage < 0) { @@ -3386,7 +3387,7 @@ static int ram_save_live(Monitor *mon, QEMUFile *f, int stage, void *opaque) } bytes_transferred_last = bytes_transferred; - bwidth = get_clock(); + t0 = get_clock(); while (!qemu_file_rate_limit(f)) { int ret; @@ -3397,8 +3398,8 @@ static int ram_save_live(Monitor *mon, QEMUFile *f, int stage, void *opaque) break; } - bwidth = get_clock() - bwidth; - bwidth = (bytes_transferred - bytes_transferred_last) / bwidth; + t0 = get_clock() - t0; + bwidth = (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.3.2