From dd12e1bbf2a41b0f6ce450a5449e536df0909520 Mon Sep 17 00:00:00 2001 From: "Emilio G. Cota" Date: Wed, 15 Aug 2018 16:00:03 -0400 Subject: hmp-commands: add sync-profile 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 Signed-off-by: Emilio G. Cota Signed-off-by: Paolo Bonzini --- hmp.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'hmp.c') 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); -- cgit v1.2.3