From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:37713) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TF2Qk-0000f8-0R for qemu-devel@nongnu.org; Fri, 21 Sep 2012 08:34:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TF2QY-0005O3-Qs for qemu-devel@nongnu.org; Fri, 21 Sep 2012 08:34:01 -0400 Received: from mail-pb0-f45.google.com ([209.85.160.45]:42789) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TF2QY-0005Ny-HE for qemu-devel@nongnu.org; Fri, 21 Sep 2012 08:33:50 -0400 Received: by pbbrp12 with SMTP id rp12so7585752pbb.4 for ; Fri, 21 Sep 2012 05:33:49 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <505C5EA8.7050207@redhat.com> Date: Fri, 21 Sep 2012 14:33:44 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1348217255-22441-1-git-send-email-quintela@redhat.com> <1348217255-22441-16-git-send-email-quintela@redhat.com> In-Reply-To: <1348217255-22441-16-git-send-email-quintela@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 15/41] migration: Add dirty_pages_rate to query migrate output List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Juan Quintela Cc: qemu-devel@nongnu.org Il 21/09/2012 10:47, Juan Quintela ha scritto: > It indicates how many pages were dirtied during the last second. > > Signed-off-by: Juan Quintela > --- > arch_init.c | 18 ++++++++++++++++++ > hmp.c | 4 ++++ > migration.c | 2 ++ > migration.h | 1 + > qapi-schema.json | 8 ++++++-- > 5 files changed, 31 insertions(+), 2 deletions(-) > > diff --git a/arch_init.c b/arch_init.c > index 0279d06..d96e888 100644 > --- a/arch_init.c > +++ b/arch_init.c > @@ -370,6 +370,14 @@ static void migration_bitmap_sync(void) > RAMBlock *block; > ram_addr_t addr; > uint64_t num_dirty_pages_init = migration_dirty_pages; > + MigrationState *s = migrate_get_current(); > + static int64_t start_time; > + static int64_t num_dirty_pages_period; > + int64_t end_time; > + > + if (!start_time) { > + start_time = qemu_get_clock_ms(rt_clock); > + } > > trace_migration_bitmap_sync_start(); > memory_global_sync_dirty_bitmap(get_system_memory()); > @@ -386,6 +394,16 @@ static void migration_bitmap_sync(void) > } > trace_migration_bitmap_sync_end(migration_dirty_pages > - num_dirty_pages_init); > + num_dirty_pages_period += migration_dirty_pages - num_dirty_pages_init; > + end_time = qemu_get_clock_ms(rt_clock); > + > + /* more than 1 second = 1000 millisecons */ > + if (end_time > start_time + 1000) { > + s->dirty_pages_rate = num_dirty_pages_period * 1000 > + / (end_time - start_time); > + start_time = end_time; > + num_dirty_pages_period = 0; > + } > } Ok, this makes use of patch 6 as well. I'd still prefer the interface change to the save_live functions for cumulating the expected downtime across all save_live functions, but feel free to ignore me. Paolo > > diff --git a/hmp.c b/hmp.c > index 71c9292..67a529a 100644 > --- a/hmp.c > +++ b/hmp.c > @@ -175,6 +175,10 @@ void hmp_info_migrate(Monitor *mon) > info->ram->normal); > monitor_printf(mon, "normal bytes: %" PRIu64 " kbytes\n", > info->ram->normal_bytes >> 10); > + if (info->ram->dirty_pages_rate) { > + monitor_printf(mon, "dirty pages rate: %" PRIu64 " pages\n", > + info->ram->dirty_pages_rate); > + } > } > > if (info->has_disk) { > diff --git a/migration.c b/migration.c > index 62c8fe9..05634d5 100644 > --- a/migration.c > +++ b/migration.c > @@ -180,6 +180,8 @@ MigrationInfo *qmp_query_migrate(Error **errp) > info->ram->duplicate = dup_mig_pages_transferred(); > info->ram->normal = norm_mig_pages_transferred(); > info->ram->normal_bytes = norm_mig_bytes_transferred(); > + info->ram->dirty_pages_rate = s->dirty_pages_rate; > + > > if (blk_mig_active()) { > info->has_disk = true; > diff --git a/migration.h b/migration.h > index 552200c..66d7f68 100644 > --- a/migration.h > +++ b/migration.h > @@ -42,6 +42,7 @@ struct MigrationState > int64_t total_time; > int64_t downtime; > int64_t expected_downtime; > + int64_t dirty_pages_rate; > bool enabled_capabilities[MIGRATION_CAPABILITY_MAX]; > int64_t xbzrle_cache_size; > }; > diff --git a/qapi-schema.json b/qapi-schema.json > index b8a1244..4a9ae52 100644 > --- a/qapi-schema.json > +++ b/qapi-schema.json > @@ -358,13 +358,17 @@ > # > # @normal : number of normal pages (since 1.2) > # > -# @normal-bytes : number of normal bytes sent (since 1.2) > +# @normal-bytes: number of normal bytes sent (since 1.2) > +# > +# @dirty-pages-rate: number of pages dirtied by second by the > +# guest (since 1.3) > # > # Since: 0.14.0 > ## > { 'type': 'MigrationStats', > 'data': {'transferred': 'int', 'remaining': 'int', 'total': 'int' , > - 'duplicate': 'int', 'normal': 'int', 'normal-bytes': 'int' } } > + 'duplicate': 'int', 'normal': 'int', 'normal-bytes': 'int', > + 'dirty-pages-rate' : 'int' } } > > ## > # @XBZRLECacheStats >