ram: Move xbzrle_pages into RAMState

Signed-off-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>

--

Comment why we need bytes and pages
This commit is contained in:
Juan Quintela 2017-03-13 20:59:32 +01:00
parent 07ed50a2bb
commit f36ada95de

View File

@ -172,8 +172,11 @@ struct RAMState {
uint64_t norm_pages;
/* Iterations since start */
uint64_t iterations;
/* xbzrle transmitted bytes */
/* xbzrle transmitted bytes. Notice that this is with
* compression, they can't be calculated from the pages */
uint64_t xbzrle_bytes;
/* xbzrle transmmited pages */
uint64_t xbzrle_pages;
};
typedef struct RAMState RAMState;
@ -181,7 +184,6 @@ static RAMState ram_state;
/* accounting for migration statistics */
typedef struct AccountingInfo {
uint64_t xbzrle_pages;
uint64_t xbzrle_cache_miss;
double xbzrle_cache_miss_rate;
uint64_t xbzrle_overflows;
@ -211,7 +213,7 @@ uint64_t xbzrle_mig_bytes_transferred(void)
uint64_t xbzrle_mig_pages_transferred(void)
{
return acct_info.xbzrle_pages;
return ram_state.xbzrle_pages;
}
uint64_t xbzrle_mig_pages_cache_miss(void)
@ -544,7 +546,7 @@ static int save_xbzrle_page(RAMState *rs, QEMUFile *f, uint8_t **current_data,
qemu_put_be16(f, encoded_len);
qemu_put_buffer(f, XBZRLE.encoded_buf, encoded_len);
bytes_xbzrle += encoded_len + 1 + 2;
acct_info.xbzrle_pages++;
rs->xbzrle_pages++;
rs->xbzrle_bytes += bytes_xbzrle;
*bytes_transferred += bytes_xbzrle;
@ -1998,6 +2000,7 @@ static int ram_save_init_globals(RAMState *rs)
rs->norm_pages = 0;
rs->iterations = 0;
rs->xbzrle_bytes = 0;
rs->xbzrle_pages = 0;
migration_bitmap_sync_init(rs);
qemu_mutex_init(&migration_bitmap_mutex);