]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
hmp-commands: add sync-profile
authorEmilio G. Cota <cota@braap.org>
Wed, 15 Aug 2018 20:00:03 +0000 (16:00 -0400)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 23 Aug 2018 16:46:25 +0000 (18:46 +0200)
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

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Emilio G. Cota <cota@braap.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
hmp-commands.hx
hmp.c
hmp.h

index c1fc747403ad87b09fce67ac5bc0c9b4ea07d174..db0c681f747197a654cd57603c356461e5a1abc0 100644 (file)
@@ -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,
+    },
+
+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
 
     {
diff --git a/hmp.c b/hmp.c
index 2aafb50e8e95546ad7732f5e159ad71ddf2f09b8..d94a47f7c747d714ddb14f9849247e18e81477ed 100644 (file)
--- 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.h b/hmp.h
index 33354f1bddf170ac7b258c82b1f710c363b34280..5f1addcca20e7b1fd8a126aea4b8e38425c51774 100644 (file)
--- 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);