All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sanidhya Kashyap <sanidhya.iiith@gmail.com>
To: qemu list <qemu-devel@nongnu.org>
Cc: Sanidhya Kashyap <sanidhya.iiith@gmail.com>,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
	Juan Quintela <quintela@redhat.com>
Subject: [Qemu-devel] [PATCH v5 3/6] BitmapLog: get the information about the parameters
Date: Fri,  1 Aug 2014 08:42:28 +0530	[thread overview]
Message-ID: <1406862751-24008-4-git-send-email-sanidhya.iiith@gmail.com> (raw)
In-Reply-To: <1406862751-24008-1-git-send-email-sanidhya.iiith@gmail.com>

No functional change except the variable name.

Signed-off-by: Sanidhya Kashyap <sanidhya.iiith@gmail.com>
---
 hmp-commands.hx  |  2 ++
 hmp.c            | 19 +++++++++++++++++++
 hmp.h            |  1 +
 monitor.c        |  7 +++++++
 qapi-schema.json | 28 ++++++++++++++++++++++++++++
 qmp-commands.hx  | 25 +++++++++++++++++++++++++
 savevm.c         | 17 +++++++++++++++++
 7 files changed, 99 insertions(+)

diff --git a/hmp-commands.hx b/hmp-commands.hx
index 30b553e..dca65bc 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -1780,6 +1780,8 @@ show qdev device model list
 show roms
 @item info tpm
 show the TPM device
+@item info log_dirty_bitmap
+show the current parameters values
 @end table
 ETEXI
 
diff --git a/hmp.c b/hmp.c
index d067420..0a8831b 100644
--- a/hmp.c
+++ b/hmp.c
@@ -1732,3 +1732,22 @@ void hmp_info_memdev(Monitor *mon, const QDict *qdict)
 
     monitor_printf(mon, "\n");
 }
+
+void hmp_info_log_dirty_bitmap(Monitor *mon, const QDict *qdict)
+{
+    Error *err = NULL;
+    BitmapLogStateInfo *info = qmp_query_log_dirty_bitmap(&err);
+
+    if (info) {
+        monitor_printf(mon, "current iteration: %ld\n",
+                       info->current_iteration);
+        monitor_printf(mon, "total iterations: %ld\n", info->iterations);
+        monitor_printf(mon, "current period value: %ld\n", info->period);
+    }
+
+    if (err) {
+        hmp_handle_error(mon, &err);
+    }
+
+    qapi_free_BitmapLogStateInfo(info);
+}
diff --git a/hmp.h b/hmp.h
index 0895182..02e8ee4 100644
--- a/hmp.h
+++ b/hmp.h
@@ -38,6 +38,7 @@ void hmp_info_balloon(Monitor *mon, const QDict *qdict);
 void hmp_info_pci(Monitor *mon, const QDict *qdict);
 void hmp_info_block_jobs(Monitor *mon, const QDict *qdict);
 void hmp_info_tpm(Monitor *mon, const QDict *qdict);
+void hmp_info_log_dirty_bitmap(Monitor *mon, const QDict *qdict);
 void hmp_quit(Monitor *mon, const QDict *qdict);
 void hmp_stop(Monitor *mon, const QDict *qdict);
 void hmp_system_reset(Monitor *mon, const QDict *qdict);
diff --git a/monitor.c b/monitor.c
index 5bc70a6..5f20f72 100644
--- a/monitor.c
+++ b/monitor.c
@@ -2918,6 +2918,13 @@ static mon_cmd_t info_cmds[] = {
         .mhandler.cmd = hmp_info_memdev,
     },
     {
+        .name       = "log_dirty_bitmap",
+        .args_type  = "",
+        .params     = "",
+        .help       = "show the current parameters values",
+        .mhandler.cmd = hmp_info_log_dirty_bitmap,
+    },
+    {
         .name       = NULL,
     },
 };
diff --git a/qapi-schema.json b/qapi-schema.json
index dced3c2..6aac367 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -3515,3 +3515,31 @@
   'data'    : { 'filename'      : 'str',
                 '*iterations'   : 'int',
                 '*period'       : 'int' } }
+##
+# @BitmapLogStateInfo
+#
+# Provides information for the bitmap logging process
+#
+# @current-iteration: stores current iteration value
+#
+# @iterations: total iterations value
+#
+# @period: the time difference in milliseconds between each iteration
+#
+# Since 2.2
+##
+{ 'type': 'BitmapLogStateInfo',
+  'data': { 'current-iteration' : 'int',
+            'iterations'        : 'int',
+            'period'            : 'int' } }
+
+##
+# @query-log-dirty-bitmap
+#
+# Get the current values of the parameters involved in bitmap logging process
+#
+# This command returns the BitmapLogStateInfo
+#
+# Since 2.2
+##
+{ 'command': 'query-log-dirty-bitmap', 'returns': 'BitmapLogStateInfo' }
diff --git a/qmp-commands.hx b/qmp-commands.hx
index 2ead2ca..e79ed6a 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -3789,3 +3789,28 @@ Examples:
 Note: The iterations, and period parameters are optional. iterations default
 value is 3 while that of period is 10.
 EQMP
+
+    {
+        .name       = "query-log-dirty-bitmap",
+        .args_type  = "",
+        .mhandler.cmd_new = qmp_marshal_input_query_log_dirty_bitmap,
+    },
+
+SQMP
+query-log-dirty-bitmap
+----------------------
+
+Get the parameters information
+
+- "current-iteration": stores current iteration value
+- "iterations": total iterations value
+- "period": the time difference in milliseconds between each iteration
+
+Example:
+
+-> { "execute": "query-log-dirty-bitmap" }
+<- { "return": {
+            "current-iteration": 3
+            "iterations": 10
+            "period": 100 } }
+EQMP
diff --git a/savevm.c b/savevm.c
index 125e5ed..22e84fe 100644
--- a/savevm.c
+++ b/savevm.c
@@ -1515,6 +1515,23 @@ void qmp_log_dirty_bitmap(const char *filename, bool has_iterations,
     return;
 }
 
+BitmapLogStateInfo *qmp_query_log_dirty_bitmap(Error **errp)
+{
+    BitmapLogState *b = log_bitmap_get_current_state();
+    BitmapLogStateInfo *info = NULL;
+
+    if (b->state != LOG_BITMAP_STATE_ACTIVE) {
+        return info;
+    }
+
+    info = g_malloc0(sizeof(BitmapLogStateInfo));
+    info->current_iteration = b->current_iteration;
+    info->iterations = b->iterations;
+    info->period = b->current_period;
+
+    return info;
+}
+
 void qmp_xen_save_devices_state(const char *filename, Error **errp)
 {
     QEMUFile *f;
-- 
1.9.3

  parent reply	other threads:[~2014-08-01  3:13 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-01  3:12 [Qemu-devel] [PATCH v5 0/6] Obtain dirty bitmap via VM logging Sanidhya Kashyap
2014-08-01  3:12 ` [Qemu-devel] [PATCH v5 1/6] generic function between migration and bitmap dump Sanidhya Kashyap
2014-08-12 10:37   ` Dr. David Alan Gilbert
2014-08-01  3:12 ` [Qemu-devel] [PATCH v5 2/6] BitmapLog: bitmap dump code Sanidhya Kashyap
2014-08-12 11:15   ` Dr. David Alan Gilbert
2014-08-12 13:12   ` Eric Blake
2014-08-01  3:12 ` Sanidhya Kashyap [this message]
2014-08-12 11:20   ` [Qemu-devel] [PATCH v5 3/6] BitmapLog: get the information about the parameters Dr. David Alan Gilbert
2014-08-12 13:53   ` Eric Blake
2014-08-01  3:12 ` [Qemu-devel] [PATCH v5 4/6] BitmapLog: cancel mechanism for an already running dump bitmap process Sanidhya Kashyap
2014-08-12 13:55   ` Eric Blake
2014-08-01  3:12 ` [Qemu-devel] [PATCH v5 5/6] BitmapLog: set the period of the " Sanidhya Kashyap
2014-08-12 13:57   ` Eric Blake
2014-08-01  3:12 ` [Qemu-devel] [PATCH v5 6/6] BitmapLog: python script for extracting bitmap from a binary file Sanidhya Kashyap
2014-08-12 12:36   ` Dr. David Alan Gilbert
2014-08-12 14:04     ` Dr. David Alan Gilbert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1406862751-24008-4-git-send-email-sanidhya.iiith@gmail.com \
    --to=sanidhya.iiith@gmail.com \
    --cc=dgilbert@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.