Skip to content

Commit dd12e1b

Browse files
cotabonzini
authored andcommitted
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 <[email protected]> Signed-off-by: Emilio G. Cota <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 12df189 commit dd12e1b

File tree

3 files changed

+40
-0
lines changed

3 files changed

+40
-0
lines changed

hmp-commands.hx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,21 @@ sendkey ctrl-alt-f1
643643

644644
This command is useful to send keys that your graphical user interface
645645
intercepts at low level, such as @code{ctrl-alt-f1} in X Window.
646+
ETEXI
647+
{
648+
.name = "sync-profile",
649+
.args_type = "op:s?",
650+
.params = "[on|off|reset]",
651+
.help = "enable, disable or reset synchronization profiling. "
652+
"With no arguments, prints whether profiling is on or off.",
653+
.cmd = hmp_sync_profile,
654+
},
655+
656+
STEXI
657+
@item sync-profile [on|off|reset]
658+
@findex sync-profile
659+
Enable, disable or reset synchronization profiling. With no arguments, prints
660+
whether profiling is on or off.
646661
ETEXI
647662

648663
{

hmp.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1062,6 +1062,30 @@ void hmp_stop(Monitor *mon, const QDict *qdict)
10621062
qmp_stop(NULL);
10631063
}
10641064

1065+
void hmp_sync_profile(Monitor *mon, const QDict *qdict)
1066+
{
1067+
const char *op = qdict_get_try_str(qdict, "op");
1068+
1069+
if (op == NULL) {
1070+
bool on = qsp_is_enabled();
1071+
1072+
monitor_printf(mon, "sync-profile is %s\n", on ? "on" : "off");
1073+
return;
1074+
}
1075+
if (!strcmp(op, "on")) {
1076+
qsp_enable();
1077+
} else if (!strcmp(op, "off")) {
1078+
qsp_disable();
1079+
} else if (!strcmp(op, "reset")) {
1080+
qsp_reset();
1081+
} else {
1082+
Error *err = NULL;
1083+
1084+
error_setg(&err, QERR_INVALID_PARAMETER, op);
1085+
hmp_handle_error(mon, &err);
1086+
}
1087+
}
1088+
10651089
void hmp_system_reset(Monitor *mon, const QDict *qdict)
10661090
{
10671091
qmp_system_reset(NULL);

hmp.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ void hmp_info_tpm(Monitor *mon, const QDict *qdict);
4242
void hmp_info_iothreads(Monitor *mon, const QDict *qdict);
4343
void hmp_quit(Monitor *mon, const QDict *qdict);
4444
void hmp_stop(Monitor *mon, const QDict *qdict);
45+
void hmp_sync_profile(Monitor *mon, const QDict *qdict);
4546
void hmp_system_reset(Monitor *mon, const QDict *qdict);
4647
void hmp_system_powerdown(Monitor *mon, const QDict *qdict);
4748
void hmp_exit_preconfig(Monitor *mon, const QDict *qdict);

0 commit comments

Comments
 (0)