From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42027) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XG09q-0006H7-3E for qemu-devel@nongnu.org; Sat, 09 Aug 2014 02:29:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XG09g-0001ee-Sj for qemu-devel@nongnu.org; Sat, 09 Aug 2014 02:29:38 -0400 Received: from mail-qg0-x232.google.com ([2607:f8b0:400d:c04::232]:64708) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XG09g-0001dg-N1 for qemu-devel@nongnu.org; Sat, 09 Aug 2014 02:29:28 -0400 Received: by mail-qg0-f50.google.com with SMTP id q108so7086457qgd.9 for ; Fri, 08 Aug 2014 23:29:28 -0700 (PDT) From: Sanidhya Kashyap Date: Sat, 9 Aug 2014 02:26:34 -0400 Message-Id: <1407565595-18861-6-git-send-email-sanidhya.iiith@gmail.com> In-Reply-To: <1407565595-18861-1-git-send-email-sanidhya.iiith@gmail.com> References: <1407565595-18861-1-git-send-email-sanidhya.iiith@gmail.com> Subject: [Qemu-devel] [RFC PATCH v3 5/6] VMState test: update period of vmstate testing process List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu list Cc: Sanidhya Kashyap , "Dr. David Alan Gilbert" , Juan Quintela Signed-off-by: Sanidhya Kashyap --- hmp-commands.hx | 15 +++++++++++++++ hmp.c | 14 ++++++++++++++ hmp.h | 1 + qapi-schema.json | 12 ++++++++++++ qmp-commands.hx | 21 +++++++++++++++++++++ savevm.c | 13 +++++++++++++ 6 files changed, 76 insertions(+) diff --git a/hmp-commands.hx b/hmp-commands.hx index 1a28e63..f74b935 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -1808,6 +1808,21 @@ STEXI dumps and reads the device state's data from the memory for testing purpose ETEXI + { + .name = "test_vmstates_set_period", + .args_type = "period:i", + .params = "period", + .help = "set the sleep interval for vmstates testing process\n\t\t\t" + "period: the new sleep interval value to replace the existing", + .mhandler.cmd = hmp_test_vmstates_set_period, + }, + +STEXI +@item test_vmstates_set_period @var{period} +@findex test_vmstates_set_period +Set the period to @var{period} (int) for vmstate testing process. +ETEXI + STEXI @end table ETEXI diff --git a/hmp.c b/hmp.c index 5d66975..d1f3045 100644 --- a/hmp.c +++ b/hmp.c @@ -1785,3 +1785,17 @@ void hmp_info_test_vmstates(Monitor *mon, const QDict *qdict) qapi_free_VMStateLogStateInfo(log_info); } + +void hmp_test_vmstates_set_period(Monitor *mon, const QDict *qdict) +{ + int64_t period = qdict_get_int(qdict, "period"); + Error *err = NULL; + + qmp_test_vmstates_set_period(period, &err); + + if (err) { + monitor_printf(mon, "test-vmstates-set-period: %s\n", + error_get_pretty(err)); + error_free(err); + } +} diff --git a/hmp.h b/hmp.h index 881964a..32221e3 100644 --- a/hmp.h +++ b/hmp.h @@ -97,6 +97,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_period(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 b7408df..cff9b0f 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -3565,3 +3565,15 @@ # Since 2.2 ## { 'command': 'query-test-vmstates', 'returns': 'VMStateLogStateInfo' } + +## +# @test-vmstates-set-period +# +# sets the sleep interval between iterations of the vmstate testing process +# +# @period: the updated sleep interval value (in milliseconds) +# +# Since 2.2 +## +{ 'command' : 'test-vmstates-set-period', + 'data' : { 'period': 'int' } } diff --git a/qmp-commands.hx b/qmp-commands.hx index 84f8fc8..bde4fc9 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -3859,3 +3859,24 @@ Example: "devices": [ { 'device': 'hpet', 'version': 2 }, { 'device': 'mc146818rtc', 'version': 3 } ] } } EQMP + { + .name = "test-vmstates-set-period", + .args_type = "period:i", + .mhandler.cmd_new = qmp_marshal_input_test_vmstates_set_period, + }, + +SQMP +test-vmstates-set-period +------------------------ + +Update the sleep interval for the remaining iterations + +Arguments: + +- "period": the updated sleep interval between iterations (json-int) + +Example: + +-> { "execute": "test-vmstates-set-period", "arguments": { "period": 1024 } } +<- { "return": {} } +EQMP diff --git a/savevm.c b/savevm.c index 2709035..6ef69a1 100644 --- a/savevm.c +++ b/savevm.c @@ -1440,6 +1440,19 @@ VMStateLogStateInfo *qmp_query_test_vmstates(Error **errp) return log_info; } +void qmp_test_vmstates_set_period(int64_t period, Error **errp) +{ + VMStateLogState *v = test_vmstates_get_current_state(); + if (period < TEST_VMSTATE_MIN_INTERVAL_MS || + period > TEST_VMSTATE_MAX_INTERVAL_MS) { + error_setg(errp, "sleep interval (period) value must be " + "in the defined range [%d, %d](ms)\n", + TEST_VMSTATE_MIN_INTERVAL_MS, TEST_VMSTATE_MAX_INTERVAL_MS); + return; + } + v->period = period; +} + /* * ---------------------------------------------------------------------------- */ -- 1.9.3