Patchwork [2/4] migration: calculate end time after we have sent the data

login
register
mail settings
Submitter Juan Quintela
Date Feb. 22, 2013, 10:16 a.m.
Message ID <1361528201-15422-3-git-send-email-quintela@redhat.com>
Download mbox | patch
Permalink /patch/222499/
State New
Headers show

Comments

Juan Quintela - Feb. 22, 2013, 10:16 a.m.
Signed-off-by: Juan Quintela <quintela@redhat.com>


Reviewed-by: Orit Wasserman <owasserm@redhat.com>
---
 migration.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Patch

diff --git a/migration.c b/migration.c
index b3f5ba4..b8e412f 100644
--- a/migration.c
+++ b/migration.c
@@ -673,7 +673,7 @@  static void *buffered_file_thread(void *opaque)
     qemu_mutex_unlock_iothread();

     while (true) {
-        int64_t current_time = qemu_get_clock_ms(rt_clock);
+        int64_t current_time;
         uint64_t pending_size;

         qemu_mutex_lock_iothread();
@@ -727,6 +727,7 @@  static void *buffered_file_thread(void *opaque)
             }
         }
         qemu_mutex_unlock_iothread();
+        current_time = qemu_get_clock_ms(rt_clock);
         if (current_time >= initial_time + BUFFER_DELAY) {
             uint64_t transferred_bytes = s->bytes_xfer;
             uint64_t time_spent = current_time - initial_time;