diff options
author | Juan Quintela <quintela@redhat.com> | 2017-03-13 19:51:13 +0100 |
---|---|---|
committer | Juan Quintela <quintela@redhat.com> | 2017-04-21 12:25:36 +0200 |
commit | 36040d9cb25454d21a04d322423e36a0bd3975c5 (patch) | |
tree | 79650203f7177c8e6b1083f431d4e32ab6c32ad5 /migration | |
parent | b5833fde40b1c32eb80887cf55e971973856a412 (diff) |
ram: Move iterations_prev into RAMState
Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Diffstat (limited to 'migration')
-rw-r--r-- | migration/ram.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/migration/ram.c b/migration/ram.c index 32b1cbb0cd..5b6fef8575 100644 --- a/migration/ram.c +++ b/migration/ram.c @@ -163,6 +163,8 @@ struct RAMState { uint64_t num_dirty_pages_period; /* xbzrle misses since the beginning of the period */ uint64_t xbzrle_cache_miss_prev; + /* number of iterations at the beginning of period */ + uint64_t iterations_prev; }; typedef struct RAMState RAMState; @@ -625,16 +627,13 @@ static void migration_bitmap_sync_range(RAMState *rs, ram_addr_t start, start, length, &rs->num_dirty_pages_period); } -/* Fix me: there are too many global variables used in migration process. */ -static uint64_t iterations_prev; - static void migration_bitmap_sync_init(RAMState *rs) { rs->time_last_bitmap_sync = 0; rs->bytes_xfer_prev = 0; rs->num_dirty_pages_period = 0; rs->xbzrle_cache_miss_prev = 0; - iterations_prev = 0; + rs->iterations_prev = 0; } /** @@ -712,13 +711,13 @@ static void migration_bitmap_sync(RAMState *rs) } if (migrate_use_xbzrle()) { - if (iterations_prev != acct_info.iterations) { + if (rs->iterations_prev != acct_info.iterations) { acct_info.xbzrle_cache_miss_rate = (double)(acct_info.xbzrle_cache_miss - rs->xbzrle_cache_miss_prev) / - (acct_info.iterations - iterations_prev); + (acct_info.iterations - rs->iterations_prev); } - iterations_prev = acct_info.iterations; + rs->iterations_prev = acct_info.iterations; rs->xbzrle_cache_miss_prev = acct_info.xbzrle_cache_miss; } s->dirty_pages_rate = rs->num_dirty_pages_period * 1000 |