From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48822) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XSnsk-0000E4-Pb for qemu-devel@nongnu.org; Sat, 13 Sep 2014 10:01:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XSnsa-0002D5-Ok for qemu-devel@nongnu.org; Sat, 13 Sep 2014 10:00:54 -0400 Received: from mail-yh0-x229.google.com ([2607:f8b0:4002:c01::229]:51985) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XSnsa-0002Cr-Hy for qemu-devel@nongnu.org; Sat, 13 Sep 2014 10:00:44 -0400 Received: by mail-yh0-f41.google.com with SMTP id t59so1159583yho.28 for ; Sat, 13 Sep 2014 07:00:44 -0700 (PDT) From: Sanidhya Kashyap Date: Sat, 13 Sep 2014 10:00:11 -0400 Message-Id: <1410616814-27388-4-git-send-email-sanidhya.iiith@gmail.com> In-Reply-To: <1410616814-27388-1-git-send-email-sanidhya.iiith@gmail.com> References: <1410616814-27388-1-git-send-email-sanidhya.iiith@gmail.com> Subject: [Qemu-devel] [PATCH v6 3/6] BitmapLog: get the information about the parameters 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 --- Removed acronyms, no functional change. hmp-commands.hx | 2 ++ hmp.c | 21 +++++++++++++++++++++ hmp.h | 1 + monitor.c | 7 +++++++ qapi-schema.json | 28 ++++++++++++++++++++++++++++ qmp-commands.hx | 25 +++++++++++++++++++++++++ savevm.c | 17 +++++++++++++++++ 7 files changed, 101 insertions(+) diff --git a/hmp-commands.hx b/hmp-commands.hx index d104232..d336f20 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -1778,6 +1778,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..4533dcd 100644 --- a/hmp.c +++ b/hmp.c @@ -1732,3 +1732,24 @@ 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: %" PRId64 "\n", + info->current_iteration); + monitor_printf(mon, "total iterations: %" PRId64 "\n", + info->iterations); + monitor_printf(mon, "current period value: %" PRId64 "\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 34cee74..ba79375 100644 --- a/monitor.c +++ b/monitor.c @@ -2921,6 +2921,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 f96e959..d1b44f4 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -3518,3 +3518,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 db0a8ed..9582bc7 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -3786,3 +3786,28 @@ Examples: <- { "return": {} } 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 19f7b0c..75fdd04 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.1