* Gonglei (Arei) (arei.gong...@huawei.com) wrote:
> Add counters to log the times of updating the dirty bitmap.

Reviewed-by: Dr. David Alan Gilbert <dgilb...@redhat.com>

> Signed-off-by: ChenLiang <chenlian...@huawei.com>
> Signed-off-by: Gonglei <arei.gong...@huawei.com>
> ---
>  arch_init.c | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
> 
> diff --git a/arch_init.c b/arch_init.c
> index bc8d0eb..6823c5a 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 */
>  
> @@ -450,6 +467,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();
>      }
> @@ -692,6 +711,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()) {
>          XBZRLE.cache = cache_init(migrate_xbzrle_cache_size() /
> -- 
> 1.7.12.4
> 
> 
> Best regards,
> -Gonglei
> 
> 
> 
--
Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK

Reply via email to