summaryrefslogtreecommitdiff
path: root/arch_init.c
diff options
context:
space:
mode:
authorChenLiang <chenliang88@huawei.com>2014-04-04 17:57:56 +0800
committerJuan Quintela <quintela@redhat.com>2014-05-05 22:15:03 +0200
commit8bc3923343e91902ca541112b3bdb5448f8d288e (patch)
tree2f6a005134c54ba599e21675ea93e1f2d4fcc0ae /arch_init.c
parent58570ed894631904bcdbcd1e8b34479cebe2aae9 (diff)
migration: expose xbzrle cache miss rate
expose xbzrle cache miss rate Signed-off-by: ChenLiang <chenliang88@huawei.com> Signed-off-by: Gonglei <arei.gonglei@huawei.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
Diffstat (limited to 'arch_init.c')
-rw-r--r--arch_init.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/arch_init.c b/arch_init.c
index 5f05e992df..be743fd1d0 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -236,6 +236,7 @@ typedef struct AccountingInfo {
uint64_t xbzrle_bytes;
uint64_t xbzrle_pages;
uint64_t xbzrle_cache_miss;
+ double xbzrle_cache_miss_rate;
uint64_t xbzrle_overflows;
} AccountingInfo;
@@ -291,6 +292,11 @@ uint64_t xbzrle_mig_pages_cache_miss(void)
return acct_info.xbzrle_cache_miss;
}
+double xbzrle_mig_cache_miss_rate(void)
+{
+ return acct_info.xbzrle_cache_miss_rate;
+}
+
uint64_t xbzrle_mig_pages_overflow(void)
{
return acct_info.xbzrle_overflows;
@@ -489,6 +495,8 @@ static void migration_bitmap_sync(void)
static int64_t num_dirty_pages_period;
int64_t end_time;
int64_t bytes_xfer_now;
+ static uint64_t xbzrle_cache_miss_prev;
+ static uint64_t iterations_prev;
bitmap_sync_count++;
@@ -532,6 +540,16 @@ static void migration_bitmap_sync(void)
} else {
mig_throttle_on = false;
}
+ if (migrate_use_xbzrle()) {
+ if (iterations_prev != 0) {
+ acct_info.xbzrle_cache_miss_rate =
+ (double)(acct_info.xbzrle_cache_miss -
+ xbzrle_cache_miss_prev) /
+ (acct_info.iterations - iterations_prev);
+ }
+ iterations_prev = acct_info.iterations;
+ xbzrle_cache_miss_prev = acct_info.xbzrle_cache_miss;
+ }
s->dirty_pages_rate = num_dirty_pages_period * 1000
/ (end_time - start_time);
s->dirty_bytes_rate = s->dirty_pages_rate * TARGET_PAGE_SIZE;