[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v5 04/10] migration: expose xbzrle cache miss rate
From: |
arei.gonglei |
Subject: |
[Qemu-devel] [PATCH v5 04/10] migration: expose xbzrle cache miss rate |
Date: |
Fri, 4 Apr 2014 17:57:56 +0800 |
From: ChenLiang <address@hidden>
expose xbzrle cache miss rate
Signed-off-by: ChenLiang <address@hidden>
Signed-off-by: Gonglei <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
---
arch_init.c | 18 ++++++++++++++++++
hmp.c | 2 ++
include/migration/migration.h | 1 +
migration.c | 1 +
qapi-schema.json | 5 ++++-
qmp-commands.hx | 2 ++
6 files changed, 28 insertions(+), 1 deletion(-)
diff --git a/arch_init.c b/arch_init.c
index a7c87de..15ca4c0 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -235,6 +235,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;
@@ -290,6 +291,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;
@@ -488,6 +494,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++;
@@ -531,6 +539,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;
diff --git a/hmp.c b/hmp.c
index 77a8d18..18a850d 100644
--- a/hmp.c
+++ b/hmp.c
@@ -214,6 +214,8 @@ void hmp_info_migrate(Monitor *mon, const QDict *qdict)
info->xbzrle_cache->pages);
monitor_printf(mon, "xbzrle cache miss: %" PRIu64 "\n",
info->xbzrle_cache->cache_miss);
+ monitor_printf(mon, "xbzrle cache miss rate: %0.2f\n",
+ info->xbzrle_cache->cache_miss_rate);
monitor_printf(mon, "xbzrle overflow : %" PRIu64 "\n",
info->xbzrle_cache->overflow);
}
diff --git a/include/migration/migration.h b/include/migration/migration.h
index 9e62b99..430e48d 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -126,6 +126,7 @@ uint64_t xbzrle_mig_bytes_transferred(void);
uint64_t xbzrle_mig_pages_transferred(void);
uint64_t xbzrle_mig_pages_overflow(void);
uint64_t xbzrle_mig_pages_cache_miss(void);
+double xbzrle_mig_cache_miss_rate(void);
void ram_handle_compressed(void *host, uint8_t ch, uint64_t size);
diff --git a/migration.c b/migration.c
index 816f5fb..44b6ca2 100644
--- a/migration.c
+++ b/migration.c
@@ -174,6 +174,7 @@ static void get_xbzrle_cache_stats(MigrationInfo *info)
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();
}
}
diff --git a/qapi-schema.json b/qapi-schema.json
index 8a60a6e..8450275 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -674,13 +674,16 @@
#
# @cache-miss: number of cache miss
#
+# @cache-miss-rate: rate of cache miss (since 2.1)
+#
# @overflow: number of overflows
#
# Since: 1.2
##
{ 'type': 'XBZRLECacheStats',
'data': {'cache-size': 'int', 'bytes': 'int', 'pages': 'int',
- 'cache-miss': 'int', 'overflow': 'int' } }
+ 'cache-miss': 'int', 'cache-miss-rate': 'number',
+ 'overflow': 'int' } }
##
# @MigrationInfo
diff --git a/qmp-commands.hx b/qmp-commands.hx
index aadcd04..f437937 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -2979,6 +2979,7 @@ The main json-object contains the following:
- "bytes": number of bytes transferred for XBZRLE compressed pages
- "pages": number of XBZRLE compressed pages
- "cache-miss": number of XBRZRLE page cache misses
+ - "cache-miss-rate": rate of XBRZRLE page cache misses
- "overflow": number of times XBZRLE overflows. This means
that the XBZRLE encoding was bigger than just sent the
whole page, and then we sent the whole page instead (as as
@@ -3087,6 +3088,7 @@ Examples:
"bytes":20971520,
"pages":2444343,
"cache-miss":2244,
+ "cache-miss-rate":0.123,
"overflow":34434
}
}
--
1.7.12.4
- [Qemu-devel] [PATCH v5 00/10] migration: Optimizate the xbzrle and fix one corruption issue, arei.gonglei, 2014/04/04
- [Qemu-devel] [PATCH v5 10/10] migration: clear the dead code, arei.gonglei, 2014/04/04
- [Qemu-devel] [PATCH v5 09/10] migration: optimize xbzrle by reducing data copy, arei.gonglei, 2014/04/04
- [Qemu-devel] [PATCH v5 03/10] migration: expose the bitmap_sync_count to the end, arei.gonglei, 2014/04/04
- [Qemu-devel] [PATCH v5 05/10] XBZRLE: optimize XBZRLE to decrease the cache misses, arei.gonglei, 2014/04/04
- [Qemu-devel] [PATCH v5 01/10] XBZRLE: Fix one XBZRLE corruption issues, arei.gonglei, 2014/04/04
- [Qemu-devel] [PATCH v5 04/10] migration: expose xbzrle cache miss rate,
arei.gonglei <=
- [Qemu-devel] [PATCH v5 06/10] XBZRLE: rebuild the cache_is_cached function, arei.gonglei, 2014/04/04
- [Qemu-devel] [PATCH v5 07/10] xbzrle: don't check the value in the vm ram repeatedly, arei.gonglei, 2014/04/04
- [Qemu-devel] [PATCH v5 02/10] migration: Add counts of updating the dirty bitmap, arei.gonglei, 2014/04/04
- [Qemu-devel] [PATCH v5 08/10] xbzrle: check 8 bytes at a time after an concurrency scene, arei.gonglei, 2014/04/04
- Re: [Qemu-devel] [PATCH v5 00/10] migration: Optimizate the xbzrle and fix one corruption issue, Dr. David Alan Gilbert, 2014/04/04
- [Qemu-devel] For 2.0? Re: [PATCH v5 00/10] migration: Optimizate the xbzrle and fix one corruption issue, Eric Blake, 2014/04/04