qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Orit Wasserman <owasserm@redhat.com>
To: Juan Quintela <quintela@redhat.com>
Cc: chegu_vinod@hp.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 1/7] Add spent time for migration
Date: Thu, 14 Jun 2012 13:52:54 +0300	[thread overview]
Message-ID: <4FD9C286.8060500@redhat.com> (raw)
In-Reply-To: <b2f1b2b25ea681c422b0d4465874541730b9dc04.1337710679.git.quintela@redhat.com>

On 05/22/2012 09:32 PM, Juan Quintela wrote:
> We add time spent for migration to the output of "info migrate"
> command.  'total_time' means time since the start fo migration if
> migration is 'active', and total time of migration if migration is
> completed.  As we are also interested in transferred ram when
> migration completes, adding all ram statistics
> 
> Signed-off-by: Juan Quintela <quintela@redhat.com>
> ---
>  hmp.c            |    2 ++
>  migration.c      |   11 +++++++++++
>  migration.h      |    1 +
>  qapi-schema.json |   12 +++++++++---
>  4 files changed, 23 insertions(+), 3 deletions(-)
> 
> diff --git a/hmp.c b/hmp.c
> index bb0952e..25a128b 100644
> --- a/hmp.c
> +++ b/hmp.c
> @@ -142,6 +142,8 @@ void hmp_info_migrate(Monitor *mon)
>                         info->ram->remaining >> 10);
>          monitor_printf(mon, "total ram: %" PRIu64 " kbytes\n",
>                         info->ram->total >> 10);
> +        monitor_printf(mon, "total time: %" PRIu64 " milliseconds\n",
> +                       info->ram->total_time);
>      }
> 
>      if (info->has_disk) {
> diff --git a/migration.c b/migration.c
> index 3f485d3..599bb6c 100644
> --- a/migration.c
> +++ b/migration.c
> @@ -131,6 +131,8 @@ MigrationInfo *qmp_query_migrate(Error **errp)
>          info->ram->transferred = ram_bytes_transferred();
>          info->ram->remaining = ram_bytes_remaining();
>          info->ram->total = ram_bytes_total();
> +        info->ram->total_time = qemu_get_clock_ms(rt_clock)
> +            - s->total_time;
> 
>          if (blk_mig_active()) {
>              info->has_disk = true;
> @@ -143,6 +145,13 @@ MigrationInfo *qmp_query_migrate(Error **errp)
>      case MIG_STATE_COMPLETED:
>          info->has_status = true;
>          info->status = g_strdup("completed");
> +
> +        info->has_ram = true;
> +        info->ram = g_malloc0(sizeof(*info->ram));
> +        info->ram->transferred = ram_bytes_transferred();
> +        info->ram->remaining = 0;
> +        info->ram->total = ram_bytes_total();
> +        info->ram->total_time = s->total_time;
>          break;
>      case MIG_STATE_ERROR:
>          info->has_status = true;
> @@ -260,6 +269,7 @@ 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;
>          if (s->state != MIG_STATE_COMPLETED) {
>              if (old_vm_running) {
>                  vm_start();
> @@ -373,6 +383,7 @@ static MigrationState *migrate_init(int blk, int inc)
> 
>      s->bandwidth_limit = bandwidth_limit;
>      s->state = MIG_STATE_SETUP;
> +    s->total_time = qemu_get_clock_ms(rt_clock);
> 
>      return s;
>  }
> diff --git a/migration.h b/migration.h
> index 2e9ca2e..165b27b 100644
> --- a/migration.h
> +++ b/migration.h
> @@ -33,6 +33,7 @@ struct MigrationState
>      void *opaque;
>      int blk;
>      int shared;
> +    int64_t total_time;
>  };
> 
>  void process_incoming_migration(QEMUFile *f);
> diff --git a/qapi-schema.json b/qapi-schema.json
> index 2ca7195..c5a2e99 100644
> --- a/qapi-schema.json
> +++ b/qapi-schema.json
> @@ -238,10 +238,15 @@
>  #
>  # @total: total amount of bytes involved in the migration process
>  #
> +# @total_time: tota0l amount of ms since migration started.  If
> +#        migration has ended, it returns the total migration
> +#        time. (since 1.2)
> +#
>  # Since: 0.14.0.
>  ##
>  { 'type': 'MigrationStats',
> -  'data': {'transferred': 'int', 'remaining': 'int', 'total': 'int' } }
> +  'data': {'transferred': 'int', 'remaining': 'int', 'total': 'int' ,
> +           'total_time': 'int' } }
> 
>  ##
>  # @MigrationInfo
> @@ -253,8 +258,9 @@
>  #          'cancelled'. If this field is not returned, no migration process
>  #          has been initiated
>  #
> -# @ram: #optional @MigrationStats containing detailed migration status,
> -#       only returned if status is 'active'
> +# @ram: #optional @MigrationStats containing detailed migration
> +#       status, only returned if status is 'active' or
> +#       'completed'. 'comppleted' (since 1.2)
>  #
>  # @disk: #optional @MigrationStats containing detailed disk migration
>  #        status, only returned if status is 'active' and it is a block

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

  reply	other threads:[~2012-06-14 10:53 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-22 18:32 [Qemu-devel] [RFC 0/7] Fix migration with lots of memory Juan Quintela
2012-05-22 18:32 ` [Qemu-devel] [PATCH 1/7] Add spent time for migration Juan Quintela
2012-06-14 10:52   ` Orit Wasserman [this message]
2012-05-22 18:32 ` [Qemu-devel] [PATCH 2/7] Add tracepoints for savevm section start/end Juan Quintela
2012-06-14 11:00   ` Orit Wasserman
2012-05-22 18:32 ` [Qemu-devel] [PATCH 3/7] No need to iterate if we already are over the limit Juan Quintela
2012-06-14 11:03   ` Orit Wasserman
2012-05-22 18:32 ` [Qemu-devel] [PATCH 4/7] Only TCG needs TLB handling Juan Quintela
2012-06-14 11:15   ` Orit Wasserman
2012-05-22 18:32 ` [Qemu-devel] [PATCH 5/7] Only calculate expected_time for stage 2 Juan Quintela
2012-06-14 11:31   ` Orit Wasserman
2012-05-22 18:32 ` [Qemu-devel] [PATCH 6/7] Exit loop if we have been there too long Juan Quintela
2012-06-14 11:36   ` Orit Wasserman
2012-06-21 19:34     ` Juan Quintela
2012-06-22  2:42       ` 陳韋任 (Wei-Ren Chen)
2012-06-22 12:44         ` Juan Quintela
2012-05-22 18:32 ` [Qemu-devel] [PATCH 7/7] Maintaing number of dirty pages Juan Quintela
2012-06-14 11:42   ` Orit Wasserman
2012-06-11  3:56 ` [Qemu-devel] [RFC 0/7] Fix migration with lots of memory Chegu Vinod

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4FD9C286.8060500@redhat.com \
    --to=owasserm@redhat.com \
    --cc=chegu_vinod@hp.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).