From 114f5aee02e7d815c2241c46d9f9d1c939b1f7d3 Mon Sep 17 00:00:00 2001 From: Juan Quintela Date: Thu, 4 May 2017 10:09:21 +0200 Subject: ram: Unfold get_xbzrle_cache_stats() into populate_ram_info() They were called consecutively always. Signed-off-by: Juan Quintela Reviewed-by: Eric Blake --- migration/migration.c | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) (limited to 'migration/migration.c') diff --git a/migration/migration.c b/migration/migration.c index 48c94c9ca1..b1e68c09d9 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -588,20 +588,6 @@ static bool migration_is_setup_or_active(int state) } } -static void get_xbzrle_cache_stats(MigrationInfo *info) -{ - if (migrate_use_xbzrle()) { - info->has_xbzrle_cache = true; - info->xbzrle_cache = g_malloc0(sizeof(*info->xbzrle_cache)); - info->xbzrle_cache->cache_size = migrate_xbzrle_cache_size(); - info->xbzrle_cache->bytes = xbzrle_mig_bytes_transferred(); - info->xbzrle_cache->pages = xbzrle_mig_pages_transferred(); - info->xbzrle_cache->cache_miss = xbzrle_mig_pages_cache_miss(); - info->xbzrle_cache->cache_miss_rate = xbzrle_mig_cache_miss_rate(); - info->xbzrle_cache->overflow = xbzrle_mig_pages_overflow(); - } -} - static void populate_ram_info(MigrationInfo *info, MigrationState *s) { info->has_ram = true; @@ -619,6 +605,17 @@ static void populate_ram_info(MigrationInfo *info, MigrationState *s) info->ram->postcopy_requests = ram_postcopy_requests(); info->ram->page_size = qemu_target_page_size(); + if (migrate_use_xbzrle()) { + info->has_xbzrle_cache = true; + info->xbzrle_cache = g_malloc0(sizeof(*info->xbzrle_cache)); + info->xbzrle_cache->cache_size = migrate_xbzrle_cache_size(); + info->xbzrle_cache->bytes = xbzrle_mig_bytes_transferred(); + info->xbzrle_cache->pages = xbzrle_mig_pages_transferred(); + info->xbzrle_cache->cache_miss = xbzrle_mig_pages_cache_miss(); + info->xbzrle_cache->cache_miss_rate = xbzrle_mig_cache_miss_rate(); + info->xbzrle_cache->overflow = xbzrle_mig_pages_overflow(); + } + if (s->state != MIGRATION_STATUS_COMPLETED) { info->ram->remaining = ram_bytes_remaining(); info->ram->dirty_pages_rate = ram_dirty_pages_rate(); @@ -664,7 +661,6 @@ MigrationInfo *qmp_query_migrate(Error **errp) info->cpu_throttle_percentage = cpu_throttle_get_percentage(); } - get_xbzrle_cache_stats(info); break; case MIGRATION_STATUS_POSTCOPY_ACTIVE: /* Mostly the same as active; TODO add some postcopy stats */ @@ -687,15 +683,12 @@ MigrationInfo *qmp_query_migrate(Error **errp) info->disk->total = blk_mig_bytes_total(); } - get_xbzrle_cache_stats(info); break; case MIGRATION_STATUS_COLO: info->has_status = true; /* TODO: display COLO specific information (checkpoint info etc.) */ break; case MIGRATION_STATUS_COMPLETED: - get_xbzrle_cache_stats(info); - info->has_status = true; info->has_total_time = true; info->total_time = s->total_time; -- cgit v1.2.3