提交 8bc39233 编写于 作者: C ChenLiang 提交者: Juan Quintela

migration: expose xbzrle cache miss rate

expose xbzrle cache miss rate
Signed-off-by: NChenLiang <chenliang88@huawei.com>
Signed-off-by: NGonglei <arei.gonglei@huawei.com>
Reviewed-by: NEric Blake <eblake@redhat.com>
Signed-off-by: NJuan Quintela <quintela@redhat.com>
上级 58570ed8
...@@ -236,6 +236,7 @@ typedef struct AccountingInfo { ...@@ -236,6 +236,7 @@ typedef struct AccountingInfo {
uint64_t xbzrle_bytes; uint64_t xbzrle_bytes;
uint64_t xbzrle_pages; uint64_t xbzrle_pages;
uint64_t xbzrle_cache_miss; uint64_t xbzrle_cache_miss;
double xbzrle_cache_miss_rate;
uint64_t xbzrle_overflows; uint64_t xbzrle_overflows;
} AccountingInfo; } AccountingInfo;
...@@ -291,6 +292,11 @@ uint64_t xbzrle_mig_pages_cache_miss(void) ...@@ -291,6 +292,11 @@ uint64_t xbzrle_mig_pages_cache_miss(void)
return acct_info.xbzrle_cache_miss; 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) uint64_t xbzrle_mig_pages_overflow(void)
{ {
return acct_info.xbzrle_overflows; return acct_info.xbzrle_overflows;
...@@ -489,6 +495,8 @@ static void migration_bitmap_sync(void) ...@@ -489,6 +495,8 @@ static void migration_bitmap_sync(void)
static int64_t num_dirty_pages_period; static int64_t num_dirty_pages_period;
int64_t end_time; int64_t end_time;
int64_t bytes_xfer_now; int64_t bytes_xfer_now;
static uint64_t xbzrle_cache_miss_prev;
static uint64_t iterations_prev;
bitmap_sync_count++; bitmap_sync_count++;
...@@ -532,6 +540,16 @@ static void migration_bitmap_sync(void) ...@@ -532,6 +540,16 @@ static void migration_bitmap_sync(void)
} else { } else {
mig_throttle_on = false; 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 s->dirty_pages_rate = num_dirty_pages_period * 1000
/ (end_time - start_time); / (end_time - start_time);
s->dirty_bytes_rate = s->dirty_pages_rate * TARGET_PAGE_SIZE; s->dirty_bytes_rate = s->dirty_pages_rate * TARGET_PAGE_SIZE;
......
...@@ -214,6 +214,8 @@ void hmp_info_migrate(Monitor *mon, const QDict *qdict) ...@@ -214,6 +214,8 @@ void hmp_info_migrate(Monitor *mon, const QDict *qdict)
info->xbzrle_cache->pages); info->xbzrle_cache->pages);
monitor_printf(mon, "xbzrle cache miss: %" PRIu64 "\n", monitor_printf(mon, "xbzrle cache miss: %" PRIu64 "\n",
info->xbzrle_cache->cache_miss); 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", monitor_printf(mon, "xbzrle overflow : %" PRIu64 "\n",
info->xbzrle_cache->overflow); info->xbzrle_cache->overflow);
} }
......
...@@ -124,6 +124,7 @@ uint64_t xbzrle_mig_bytes_transferred(void); ...@@ -124,6 +124,7 @@ uint64_t xbzrle_mig_bytes_transferred(void);
uint64_t xbzrle_mig_pages_transferred(void); uint64_t xbzrle_mig_pages_transferred(void);
uint64_t xbzrle_mig_pages_overflow(void); uint64_t xbzrle_mig_pages_overflow(void);
uint64_t xbzrle_mig_pages_cache_miss(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); void ram_handle_compressed(void *host, uint8_t ch, uint64_t size);
......
...@@ -174,6 +174,7 @@ static void get_xbzrle_cache_stats(MigrationInfo *info) ...@@ -174,6 +174,7 @@ static void get_xbzrle_cache_stats(MigrationInfo *info)
info->xbzrle_cache->bytes = xbzrle_mig_bytes_transferred(); info->xbzrle_cache->bytes = xbzrle_mig_bytes_transferred();
info->xbzrle_cache->pages = xbzrle_mig_pages_transferred(); info->xbzrle_cache->pages = xbzrle_mig_pages_transferred();
info->xbzrle_cache->cache_miss = xbzrle_mig_pages_cache_miss(); 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(); info->xbzrle_cache->overflow = xbzrle_mig_pages_overflow();
} }
} }
......
...@@ -674,13 +674,16 @@ ...@@ -674,13 +674,16 @@
# #
# @cache-miss: number of cache miss # @cache-miss: number of cache miss
# #
# @cache-miss-rate: rate of cache miss (since 2.1)
#
# @overflow: number of overflows # @overflow: number of overflows
# #
# Since: 1.2 # Since: 1.2
## ##
{ 'type': 'XBZRLECacheStats', { 'type': 'XBZRLECacheStats',
'data': {'cache-size': 'int', 'bytes': 'int', 'pages': 'int', 'data': {'cache-size': 'int', 'bytes': 'int', 'pages': 'int',
'cache-miss': 'int', 'overflow': 'int' } } 'cache-miss': 'int', 'cache-miss-rate': 'number',
'overflow': 'int' } }
## ##
# @MigrationInfo # @MigrationInfo
......
...@@ -2979,6 +2979,7 @@ The main json-object contains the following: ...@@ -2979,6 +2979,7 @@ The main json-object contains the following:
- "bytes": number of bytes transferred for XBZRLE compressed pages - "bytes": number of bytes transferred for XBZRLE compressed pages
- "pages": number of XBZRLE compressed pages - "pages": number of XBZRLE compressed pages
- "cache-miss": number of XBRZRLE page cache misses - "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 - "overflow": number of times XBZRLE overflows. This means
that the XBZRLE encoding was bigger than just sent the that the XBZRLE encoding was bigger than just sent the
whole page, and then we sent the whole page instead (as as whole page, and then we sent the whole page instead (as as
...@@ -3087,6 +3088,7 @@ Examples: ...@@ -3087,6 +3088,7 @@ Examples:
"bytes":20971520, "bytes":20971520,
"pages":2444343, "pages":2444343,
"cache-miss":2244, "cache-miss":2244,
"cache-miss-rate":0.123,
"overflow":34434 "overflow":34434
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册