summaryrefslogtreecommitdiffstats
path: root/migration
diff options
context:
space:
mode:
authorJuan Quintela2017-03-13 20:59:32 +0100
committerJuan Quintela2017-04-21 12:25:37 +0200
commitf36ada95dedefaf2a47f19ae3214913506716b90 (patch)
tree839bd0773b4748e0fa15f8ae0a4b2870ffdd2627 /migration
parentram: Move xbzrle_bytes into RAMState (diff)
downloadqemu-f36ada95dedefaf2a47f19ae3214913506716b90.tar.gz
qemu-f36ada95dedefaf2a47f19ae3214913506716b90.tar.xz
qemu-f36ada95dedefaf2a47f19ae3214913506716b90.zip
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
Diffstat (limited to 'migration')
-rw-r--r--migration/ram.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/migration/ram.c b/migration/ram.c
index 4dc786921e..cf6681c467 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -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);