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

login
register
mail settings
Submitter Juan Quintela
Date Feb. 1, 2013, 12:32 p.m.
Message ID <1359721976-19238-3-git-send-email-quintela@redhat.com>
Download mbox | patch
Permalink /patch/217459/
State New
Headers show

Comments

Juan Quintela - Feb. 1, 2013, 12:32 p.m.
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 migration.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Orit Wasserman - Feb. 4, 2013, 12:48 p.m.
On 02/01/2013 02:32 PM, Juan Quintela wrote:
> Signed-off-by: Juan Quintela <quintela@redhat.com>
> ---
>  migration.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/migration.c b/migration.c
> index d86946e..67abd12 100644
> --- a/migration.c
> +++ b/migration.c
> @@ -681,7 +681,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();
> @@ -735,6 +735,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;
> 
Reviewed-by: Orit Wasserman <owasserm@redhat.com>

Patch

diff --git a/migration.c b/migration.c
index d86946e..67abd12 100644
--- a/migration.c
+++ b/migration.c
@@ -681,7 +681,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();
@@ -735,6 +735,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;