Patchwork [03/41] migration: store end_time in a local variable

login
register
mail settings
Submitter Juan Quintela
Date Sept. 21, 2012, 8:46 a.m.
Message ID <1348217255-22441-4-git-send-email-quintela@redhat.com>
Download mbox | patch
Permalink /patch/185635/
State New
Headers show

Comments

Juan Quintela - Sept. 21, 2012, 8:46 a.m.
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 migration.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Paolo Bonzini - Sept. 21, 2012, 12:17 p.m.
Il 21/09/2012 10:46, Juan Quintela ha scritto:
> Signed-off-by: Juan Quintela <quintela@redhat.com>
> ---
>  migration.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/migration.c b/migration.c
> index 1edeec5..1e3f791 100644
> --- a/migration.c
> +++ b/migration.c
> @@ -327,6 +327,7 @@ static void migrate_fd_put_ready(void *opaque)
>          migrate_fd_error(s);
>      } else if (ret == 1) {
>          int old_vm_running = runstate_is_running();
> +        int64_t end_time;
> 
>          DPRINTF("done iterating\n");
>          qemu_system_wakeup_request(QEMU_WAKEUP_REASON_OTHER);
> @@ -337,7 +338,8 @@ static void migrate_fd_put_ready(void *opaque)
>          } else {
>              migrate_fd_completed(s);
>          }
> -        s->total_time = qemu_get_clock_ms(rt_clock) - s->total_time;
> +        end_time = qemu_get_clock_ms(rt_clock);
> +        s->total_time = end_time - s->total_time;
>          if (s->state != MIG_STATE_COMPLETED) {
>              if (old_vm_running) {
>                  vm_start();
> 

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Orit Wasserman - Sept. 25, 2012, 8:10 a.m.
On 09/21/2012 11:46 AM, Juan Quintela wrote:
> Signed-off-by: Juan Quintela <quintela@redhat.com>
> ---
>  migration.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/migration.c b/migration.c
> index 1edeec5..1e3f791 100644
> --- a/migration.c
> +++ b/migration.c
> @@ -327,6 +327,7 @@ static void migrate_fd_put_ready(void *opaque)
>          migrate_fd_error(s);
>      } else if (ret == 1) {
>          int old_vm_running = runstate_is_running();
> +        int64_t end_time;
> 
>          DPRINTF("done iterating\n");
>          qemu_system_wakeup_request(QEMU_WAKEUP_REASON_OTHER);
> @@ -337,7 +338,8 @@ static void migrate_fd_put_ready(void *opaque)
>          } else {
>              migrate_fd_completed(s);
>          }
> -        s->total_time = qemu_get_clock_ms(rt_clock) - s->total_time;
> +        end_time = qemu_get_clock_ms(rt_clock);
> +        s->total_time = end_time - s->total_time;
>          if (s->state != MIG_STATE_COMPLETED) {
>              if (old_vm_running) {
>                  vm_start();
> 

Reviewed-by: Orit Wasserman <owasserm@redhat.com>

Patch

diff --git a/migration.c b/migration.c
index 1edeec5..1e3f791 100644
--- a/migration.c
+++ b/migration.c
@@ -327,6 +327,7 @@  static void migrate_fd_put_ready(void *opaque)
         migrate_fd_error(s);
     } else if (ret == 1) {
         int old_vm_running = runstate_is_running();
+        int64_t end_time;

         DPRINTF("done iterating\n");
         qemu_system_wakeup_request(QEMU_WAKEUP_REASON_OTHER);
@@ -337,7 +338,8 @@  static void migrate_fd_put_ready(void *opaque)
         } else {
             migrate_fd_completed(s);
         }
-        s->total_time = qemu_get_clock_ms(rt_clock) - s->total_time;
+        end_time = qemu_get_clock_ms(rt_clock);
+        s->total_time = end_time - s->total_time;
         if (s->state != MIG_STATE_COMPLETED) {
             if (old_vm_running) {
                 vm_start();