diff options
author | Juan Quintela <quintela@redhat.com> | 2012-08-13 12:31:25 +0200 |
---|---|---|
committer | Juan Quintela <quintela@redhat.com> | 2012-10-17 18:34:58 +0200 |
commit | 8d017193e2b66a65adf53e46a6372e55470fe7fd (patch) | |
tree | 11df151e4211ec9a8b7a863c66737e713b230e38 /arch_init.c | |
parent | c6bf8e0e0cf04b40a8a22426e00ebbd727331d8b (diff) |
migration: Add dirty_pages_rate to query migrate output
It indicates how many pages were dirtied during the last second.
Signed-off-by: Juan Quintela <quintela@redhat.com>
Diffstat (limited to 'arch_init.c')
-rw-r--r-- | arch_init.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/arch_init.c b/arch_init.c index d918844028..e6effe809a 100644 --- a/arch_init.c +++ b/arch_init.c @@ -369,6 +369,14 @@ static void migration_bitmap_sync(void) RAMBlock *block; ram_addr_t addr; uint64_t num_dirty_pages_init = migration_dirty_pages; + MigrationState *s = migrate_get_current(); + static int64_t start_time; + static int64_t num_dirty_pages_period; + int64_t end_time; + + if (!start_time) { + start_time = qemu_get_clock_ms(rt_clock); + } trace_migration_bitmap_sync_start(); memory_global_sync_dirty_bitmap(get_system_memory()); @@ -385,6 +393,16 @@ static void migration_bitmap_sync(void) } trace_migration_bitmap_sync_end(migration_dirty_pages - num_dirty_pages_init); + num_dirty_pages_period += migration_dirty_pages - num_dirty_pages_init; + end_time = qemu_get_clock_ms(rt_clock); + + /* more than 1 second = 1000 millisecons */ + if (end_time > start_time + 1000) { + s->dirty_pages_rate = num_dirty_pages_period * 1000 + / (end_time - start_time); + start_time = end_time; + num_dirty_pages_period = 0; + } } |