qemu-devel.nongnu.org archive mirror
 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] [RFC PATCH v1 4/5] VMState test: set the frequency of the vmstate testing process
Date: Mon,  7 Jul 2014 22:48:03 +0530	[thread overview]
Message-ID: <1404753484-26693-5-git-send-email-sanidhya.iiith@gmail.com> (raw)
In-Reply-To: <1404753484-26693-1-git-send-email-sanidhya.iiith@gmail.com>

This patch introduces the mechanism to update the sleep interval - sinterval.

Signed-off-by: Sanidhya Kashyap <sanidhya.iiith@gmail.com>
---
 hmp-commands.hx  | 15 +++++++++++++++
 hmp.c            | 14 ++++++++++++++
 hmp.h            |  1 +
 qapi-schema.json | 10 ++++++++++
 qmp-commands.hx  | 22 ++++++++++++++++++++++
 savevm.c         | 13 +++++++++++++
 6 files changed, 75 insertions(+)

diff --git a/hmp-commands.hx b/hmp-commands.hx
index c492f3f..efe4354 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -1803,6 +1803,21 @@ STEXI
 dumps and reads the device state's data from the memory for testing purpose
 ETEXI
 
+    {
+        .name       = "test-vmstates-set-sinterval",
+        .args_type  = "sinterval:i",
+        .params     = "sinterval",
+        .help       = "set the sleep interval for vmstates testing process\n\t\t\t"
+                      "sinterval: the new sleep interval value to replace the existing",
+        .mhandler.cmd = hmp_test_vmstates_set_sinterval,
+    },
+
+STEXI
+@item test_vmstates-set-sinterval @var{sinterval}
+@findex test-vmstates-set-sinterval
+Set the sinterval to @var{sinterval} (int) for vmstate testing process.
+ETEXI
+
 STEXI
 @end table
 ETEXI
diff --git a/hmp.c b/hmp.c
index 38ec5b3..7378727 100644
--- a/hmp.c
+++ b/hmp.c
@@ -1728,3 +1728,17 @@ void hmp_test_vmstates(Monitor *mon, const QDict *qdict)
         error_free(err);
     }
 }
+
+void hmp_test_vmstates_set_sinterval(Monitor *mon, const QDict *qdict)
+{
+    int64_t sleep_interval = qdict_get_int(qdict, "sinterval");
+    Error *err = NULL;
+
+    qmp_test_vmstates_set_sinterval(sleep_interval, &err);
+
+    if (err) {
+        monitor_printf(mon, "test-vmstates-set-frequency: %s\n",
+                       error_get_pretty(err));
+        error_free(err);
+    }
+}
diff --git a/hmp.h b/hmp.h
index 9f00997..737dae2 100644
--- a/hmp.h
+++ b/hmp.h
@@ -95,6 +95,7 @@ void hmp_object_add(Monitor *mon, const QDict *qdict);
 void hmp_object_del(Monitor *mon, const QDict *qdict);
 void hmp_info_memdev(Monitor *mon, const QDict *qdict);
 void hmp_test_vmstates(Monitor *mon, const QDict *qdict);
+void hmp_test_vmstates_set_sinterval(Monitor *mon, const QDict *qdict);
 void object_add_completion(ReadLineState *rs, int nb_args, const char *str);
 void object_del_completion(ReadLineState *rs, int nb_args, const char *str);
 void device_add_completion(ReadLineState *rs, int nb_args, const char *str);
diff --git a/qapi-schema.json b/qapi-schema.json
index 92acf91..2eb8bc4 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -3492,3 +3492,13 @@
 { 'command': 'test-vmstates',
   'data': {'*times'     : 'int',
            '*sinterval' : 'int' } }
+
+## @test-vmstates-set-sinterval
+#
+# sets the sleep interval between iterations of the vmstate testing process
+# @sinterval: the updated sleep interval value
+#
+# Since 2.1
+##
+{ 'command' : 'test-vmstates-set-sinterval',
+  'data'    : { 'sinterval': 'int' } }
diff --git a/qmp-commands.hx b/qmp-commands.hx
index ccddabb..2c25dde 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -3783,3 +3783,25 @@ Example:
         "sinterval": 100 } }
 <- { "return": {} }
 EQMP
+
+    {
+        .name       = "test-vmstates-set-sinterval",
+        .args_type  = "sinterval:i",
+        .mhandler.cmd_new = qmp_marshal_input_test_vmstates_set_sinterval,
+    },
+
+SQMP
+test-vmstates-set-sinterval
+--------------------
+
+Update the sleep interval for the remaining iterations
+
+Arguments:
+
+- "sinterval": the updated sleep interval between iterations (json-int)
+
+Example:
+
+-> { "execute": "test-vmstates-set-sinterval", "arguments": { "sinterval": 1024 } }
+<- { "return": {} }
+EQMP
diff --git a/savevm.c b/savevm.c
index 3713a56..8a81355 100644
--- a/savevm.c
+++ b/savevm.c
@@ -1285,6 +1285,19 @@ void qmp_test_vmstates(bool has_times, int64_t times,
     timer_mod(v->timer, qemu_clock_get_ms(QEMU_CLOCK_REALTIME));
 }
 
+void qmp_test_vmstates_set_sinterval(int64_t sinterval, Error **errp)
+{
+    VMStateLogState *v = vmstate_current_state();
+    if (sinterval < TEST_VMSTATE_MIN_INTERVAL_MS ||
+        sinterval > TEST_VMSTATE_MAX_INTERVAL_MS) {
+        error_setg(errp, "sleep interval value must be "
+                   "in the defined range [%d, %d](ms)\n",
+                   TEST_VMSTATE_MIN_INTERVAL_MS, TEST_VMSTATE_MAX_INTERVAL_MS);
+        return;
+    }
+    v->sleep_interval = sinterval;
+}
+
 void qmp_xen_save_devices_state(const char *filename, Error **errp)
 {
     QEMUFile *f;
-- 
1.9.3

  parent reply	other threads:[~2014-07-07 17:19 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-07 17:17 [Qemu-devel] [RFC PATCH v1 0/5] VMState testing Sanidhya Kashyap
2014-07-07 17:18 ` [Qemu-devel] [RFC PATCH v1 1/5] QEMUSizedBuffer/QEMUFile Sanidhya Kashyap
2014-07-07 18:28   ` Eric Blake
2014-07-08  7:48     ` Dr. David Alan Gilbert
2014-07-07 17:18 ` [Qemu-devel] [RFC PATCH v1 2/5] VMState test: basic vmstate testing mechanism Sanidhya Kashyap
2014-07-07 17:33   ` Eric Blake
2014-07-07 17:18 ` [Qemu-devel] [RFC PATCH v1 3/5] VMState test: hmp interface for vmstate testing Sanidhya Kashyap
2014-07-07 17:18 ` Sanidhya Kashyap [this message]
2014-07-07 18:25   ` [Qemu-devel] [RFC PATCH v1 4/5] VMState test: set the frequency of the vmstate testing process Eric Blake
2014-07-18 18:59     ` Sanidhya Kashyap
2014-07-07 17:18 ` [Qemu-devel] [RFC PATCH v1 5/5] VMState test: cancel mechanism for an already running " Sanidhya Kashyap

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=1404753484-26693-5-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).