From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43473) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fqcJA-0005KJ-LG for qemu-devel@nongnu.org; Fri, 17 Aug 2018 06:48:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fqcJ9-0001GG-NE for qemu-devel@nongnu.org; Fri, 17 Aug 2018 06:48:44 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:51476 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fqcJ9-0001G2-Ga for qemu-devel@nongnu.org; Fri, 17 Aug 2018 06:48:43 -0400 Date: Fri, 17 Aug 2018 11:48:34 +0100 From: "Dr. David Alan Gilbert" Message-ID: <20180817104833.GC2459@work-vm> References: <20180817051853.23792-1-cota@braap.org> <20180817051853.23792-9-cota@braap.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180817051853.23792-9-cota@braap.org> Subject: Re: [Qemu-devel] [PATCH 8/9] hmp-commands: add sync-profile List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Emilio G. Cota" Cc: qemu-devel@nongnu.org, Paolo Bonzini , Peter Crosthwaite , Richard Henderson , Stefan Weil , Markus Armbruster , Peter Xu , Fam Zheng * Emilio G. Cota (cota@braap.org) wrote: > The command introduced here is just for developers. This means that: > > - the interface implemented here could change in the future > - the command is only meant to be used from HMP, not from QMP > > Signed-off-by: Emilio G. Cota > --- > hmp.h | 1 + > hmp.c | 24 ++++++++++++++++++++++++ > hmp-commands.hx | 15 +++++++++++++++ > 3 files changed, 40 insertions(+) > > diff --git a/hmp.h b/hmp.h > index 33354f1bdd..5f1addcca2 100644 > --- a/hmp.h > +++ b/hmp.h > @@ -42,6 +42,7 @@ void hmp_info_tpm(Monitor *mon, const QDict *qdict); > void hmp_info_iothreads(Monitor *mon, const QDict *qdict); > void hmp_quit(Monitor *mon, const QDict *qdict); > void hmp_stop(Monitor *mon, const QDict *qdict); > +void hmp_sync_profile(Monitor *mon, const QDict *qdict); > void hmp_system_reset(Monitor *mon, const QDict *qdict); > void hmp_system_powerdown(Monitor *mon, const QDict *qdict); > void hmp_exit_preconfig(Monitor *mon, const QDict *qdict); > diff --git a/hmp.c b/hmp.c > index 2aafb50e8e..d94a47f7c7 100644 > --- a/hmp.c > +++ b/hmp.c > @@ -1062,6 +1062,30 @@ void hmp_stop(Monitor *mon, const QDict *qdict) > qmp_stop(NULL); > } > > +void hmp_sync_profile(Monitor *mon, const QDict *qdict) > +{ > + const char *op = qdict_get_try_str(qdict, "op"); > + > + if (op == NULL) { > + bool on = qsp_is_enabled(); > + > + monitor_printf(mon, "sync-profile is %s\n", on ? "on" : "off"); > + return; > + } > + if (!strcmp(op, "on")) { > + qsp_enable(); > + } else if (!strcmp(op, "off")) { > + qsp_disable(); > + } else if (!strcmp(op, "reset")) { > + qsp_reset(); > + } else { > + Error *err = NULL; > + > + error_setg(&err, QERR_INVALID_PARAMETER, op); > + hmp_handle_error(mon, &err); > + } > +} > + > void hmp_system_reset(Monitor *mon, const QDict *qdict) > { > qmp_system_reset(NULL); > diff --git a/hmp-commands.hx b/hmp-commands.hx > index c1fc747403..db0c681f74 100644 > --- a/hmp-commands.hx > +++ b/hmp-commands.hx > @@ -643,6 +643,21 @@ sendkey ctrl-alt-f1 > > This command is useful to send keys that your graphical user interface > intercepts at low level, such as @code{ctrl-alt-f1} in X Window. > +ETEXI > + { > + .name = "sync-profile", > + .args_type = "op:s?", > + .params = "[on|off|reset]", > + .help = "enable, disable or reset synchronization profiling. " > + "With no arguments, prints whether profiling is on or off.", > + .cmd = hmp_sync_profile, > + }, That's OK; it'a little odd way to do it (I'd have expected a couple of booleans instead of the string); but it's OK, so Reviewed-by: Dr. David Alan Gilbert > +STEXI > +@item sync-profile [on|off|reset] > +@findex sync-profile > +Enable, disable or reset synchronization profiling. With no arguments, prints > +whether profiling is on or off. > ETEXI > > { > -- > 2.17.1 > -- Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK