From: ChenLiang <chenlian...@huawei.com> Add counters to log the times of updating the dirty bitmap.
Signed-off-by: ChenLiang <chenlian...@huawei.com> Signed-off-by: Gonglei <arei.gong...@huawei.com> Reviewed-by: Dr. David Alan Gilbert <dgilb...@redhat.com> Reviewed-by: Eric Blake <ebl...@redhat.com> --- arch_init.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/arch_init.c b/arch_init.c index 2ac68c2..37e4aa5 100644 --- a/arch_init.c +++ b/arch_init.c @@ -110,6 +110,23 @@ static bool mig_throttle_on; static int dirty_rate_high_cnt; static void check_guest_throttling(void); +static uint64_t bitmap_sync_cnt; +/* the functions *_bitmap_sync_cnt only run in migrate thread */ +static inline void reset_bitmap_sync_cnt(void) +{ + bitmap_sync_cnt = 0; +} + +static inline void increase_bitmap_sync_cnt(void) +{ + bitmap_sync_cnt++; +} + +static inline uint64_t get_bitmap_sync_cnt(void) +{ + return bitmap_sync_cnt; +} + /***********************************************************/ /* ram save/restore */ @@ -487,6 +504,8 @@ static void migration_bitmap_sync(void) int64_t end_time; int64_t bytes_xfer_now; + increase_bitmap_sync_cnt(); + if (!bytes_xfer_prev) { bytes_xfer_prev = ram_bytes_transferred(); } @@ -734,6 +753,7 @@ static int ram_save_setup(QEMUFile *f, void *opaque) migration_dirty_pages = ram_pages; mig_throttle_on = false; dirty_rate_high_cnt = 0; + reset_bitmap_sync_cnt(); if (migrate_use_xbzrle()) { qemu_mutex_lock_iothread(); -- 1.7.12.4