diff mbox

[v3,03/10] migration: expose the bitmap_sync_counter to the end user

Message ID 1395145464-5524-4-git-send-email-arei.gonglei@huawei.com
State New
Headers show

Commit Message

Gonglei (Arei) March 18, 2014, 12:24 p.m. UTC
From: ChenLiang <chenliang88@huawei.com>

expose the counter that log the times of updating the dirty bitmap to
end user.

Signed-off-by: ChenLiang <chenliang88@huawei.com>
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
---
 arch_init.c                   |  1 +
 hmp.c                         |  2 ++
 include/migration/migration.h |  1 +
 migration.c                   |  2 ++
 qapi-schema.json              |  4 +++-
 qmp-commands.hx               | 13 +++++++++----
 6 files changed, 18 insertions(+), 5 deletions(-)

Comments

Eric Blake March 20, 2014, 7:28 p.m. UTC | #1
On 03/18/2014 06:24 AM, arei.gonglei@huawei.com wrote:
> From: ChenLiang <chenliang88@huawei.com>
> 
> expose the counter that log the times of updating the dirty bitmap to

s/log/logs/

> end user.
> 
> Signed-off-by: ChenLiang <chenliang88@huawei.com>
> Signed-off-by: Gonglei <arei.gonglei@huawei.com>
> ---
>  arch_init.c                   |  1 +
>  hmp.c                         |  2 ++
>  include/migration/migration.h |  1 +
>  migration.c                   |  2 ++
>  qapi-schema.json              |  4 +++-
>  qmp-commands.hx               | 13 +++++++++----
>  6 files changed, 18 insertions(+), 5 deletions(-)
> 

> +++ b/qapi-schema.json
> @@ -651,13 +651,15 @@
>  #
>  # @mbps: throughput in megabits/sec. (since 1.6)
>  #
> +# @dirty-sync-counter: the times of ram dirty sync (since 2.1)

The name could possibly be shortened.  Also, this sentence reads
awkwardly.  Maybe:

@dirty-sync-count: number of times that dirty ram was synchronized
(since 2.1)

> +++ b/qmp-commands.hx
> @@ -2928,6 +2928,7 @@ The main json-object contains the following:
>              pages. This is just normal pages times size of one page,
>              but this way upper levels don't need to care about page
>              size (json-int)
> +         - "dirty-sync-counter": the times of ram dirty sync (json-int)

and if you do change the wording above (or even shorten the variable
name), make it match here
diff mbox

Patch

diff --git a/arch_init.c b/arch_init.c
index d1e9199..a4f9a87 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -536,6 +536,7 @@  static void migration_bitmap_sync(void)
         s->dirty_bytes_rate = s->dirty_pages_rate * TARGET_PAGE_SIZE;
         start_time = end_time;
         num_dirty_pages_period = 0;
+        s->dirty_sync_counter = bitmap_sync_counter;
     }
 }
 
diff --git a/hmp.c b/hmp.c
index 2f279c4..fd493be 100644
--- a/hmp.c
+++ b/hmp.c
@@ -188,6 +188,8 @@  void hmp_info_migrate(Monitor *mon, const QDict *qdict)
                        info->ram->normal);
         monitor_printf(mon, "normal bytes: %" PRIu64 " kbytes\n",
                        info->ram->normal_bytes >> 10);
+        monitor_printf(mon, "dirty sync counter: %" PRIu64 "\n",
+                       info->ram->dirty_sync_counter);
         if (info->ram->dirty_pages_rate) {
             monitor_printf(mon, "dirty pages rate: %" PRIu64 " pages\n",
                            info->ram->dirty_pages_rate);
diff --git a/include/migration/migration.h b/include/migration/migration.h
index 3e1e6c7..ef8b965 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -61,6 +61,7 @@  struct MigrationState
     bool enabled_capabilities[MIGRATION_CAPABILITY_MAX];
     int64_t xbzrle_cache_size;
     int64_t setup_time;
+    int64_t dirty_sync_counter;
 };
 
 void process_incoming_migration(QEMUFile *f);
diff --git a/migration.c b/migration.c
index 00f465e..d2478e4 100644
--- a/migration.c
+++ b/migration.c
@@ -220,6 +220,7 @@  MigrationInfo *qmp_query_migrate(Error **errp)
         info->ram->normal_bytes = norm_mig_bytes_transferred();
         info->ram->dirty_pages_rate = s->dirty_pages_rate;
         info->ram->mbps = s->mbps;
+        info->ram->dirty_sync_counter = s->dirty_sync_counter;
 
         if (blk_mig_active()) {
             info->has_disk = true;
@@ -253,6 +254,7 @@  MigrationInfo *qmp_query_migrate(Error **errp)
         info->ram->normal = norm_mig_pages_transferred();
         info->ram->normal_bytes = norm_mig_bytes_transferred();
         info->ram->mbps = s->mbps;
+        info->ram->dirty_sync_counter = s->dirty_sync_counter;
         break;
     case MIG_STATE_ERROR:
         info->has_status = true;
diff --git a/qapi-schema.json b/qapi-schema.json
index f4f9439..e26a2d0 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -651,13 +651,15 @@ 
 #
 # @mbps: throughput in megabits/sec. (since 1.6)
 #
+# @dirty-sync-counter: the times of ram dirty sync (since 2.1)
+#
 # Since: 0.14.0
 ##
 { 'type': 'MigrationStats',
   'data': {'transferred': 'int', 'remaining': 'int', 'total': 'int' ,
            'duplicate': 'int', 'skipped': 'int', 'normal': 'int',
            'normal-bytes': 'int', 'dirty-pages-rate' : 'int',
-           'mbps' : 'number' } }
+           'mbps' : 'number', 'dirty-sync-counter' : 'int' } }
 
 ##
 # @XBZRLECacheStats
diff --git a/qmp-commands.hx b/qmp-commands.hx
index d982cd6..5fd89cf 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -2928,6 +2928,7 @@  The main json-object contains the following:
             pages. This is just normal pages times size of one page,
             but this way upper levels don't need to care about page
             size (json-int)
+         - "dirty-sync-counter": the times of ram dirty sync (json-int)
 - "disk": only present if "status" is "active" and it is a block migration,
   it is a json-object with the following disk information:
          - "transferred": amount transferred in bytes (json-int)
@@ -2965,7 +2966,8 @@  Examples:
           "downtime":12345,
           "duplicate":123,
           "normal":123,
-          "normal-bytes":123456
+          "normal-bytes":123456,
+          "dirty-sync-counter":15
         }
      }
    }
@@ -2990,7 +2992,8 @@  Examples:
             "expected-downtime":12345,
             "duplicate":123,
             "normal":123,
-            "normal-bytes":123456
+            "normal-bytes":123456,
+            "dirty-sync-counter":15
          }
       }
    }
@@ -3010,7 +3013,8 @@  Examples:
             "expected-downtime":12345,
             "duplicate":123,
             "normal":123,
-            "normal-bytes":123456
+            "normal-bytes":123456,
+            "dirty-sync-counter":15
          },
          "disk":{
             "total":20971520,
@@ -3036,7 +3040,8 @@  Examples:
             "expected-downtime":12345,
             "duplicate":10,
             "normal":3333,
-            "normal-bytes":3412992
+            "normal-bytes":3412992,
+            "dirty-sync-counter":15
          },
          "xbzrle-cache":{
             "cache-size":67108864,