monitor: resurrect handle_qmp_command trace event

Commit 104fc30279 ("qmp: Drop duplicated
QMP command object checks") removed the call to
trace_handle_qmp_command() while eliminating code duplication.

This patch brings the trace event back so QEMU-internal trace events can
be correlated with the QMP commands that caused them.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 20170605104216.22429-3-stefanha@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
Stefan Hajnoczi 2017-06-05 11:42:16 +01:00
parent 79cad8b46b
commit b097efc002
2 changed files with 6 additions and 0 deletions

View File

@ -3809,6 +3809,7 @@ static void handle_qmp_command(JSONMessageParser *parser, GQueue *tokens)
QDict *qdict = NULL; QDict *qdict = NULL;
Monitor *mon = cur_mon; Monitor *mon = cur_mon;
Error *err = NULL; Error *err = NULL;
QString *req_json;
req = json_parser_parse_err(tokens, NULL, &err); req = json_parser_parse_err(tokens, NULL, &err);
if (!req && !err) { if (!req && !err) {
@ -3826,6 +3827,10 @@ static void handle_qmp_command(JSONMessageParser *parser, GQueue *tokens)
qdict_del(qdict, "id"); qdict_del(qdict, "id");
} /* else will fail qmp_dispatch() */ } /* else will fail qmp_dispatch() */
req_json = qobject_to_json(req);
trace_handle_qmp_command(mon, qstring_get_str(req_json));
qobject_decref(QOBJECT(req_json));
rsp = qmp_dispatch(cur_mon->qmp.commands, req); rsp = qmp_dispatch(cur_mon->qmp.commands, req);
if (mon->qmp.commands == &qmp_cap_negotiation_commands) { if (mon->qmp.commands == &qmp_cap_negotiation_commands) {

View File

@ -46,6 +46,7 @@ monitor_protocol_event_handler(uint32_t event, void *qdict) "event=%d data=%p"
monitor_protocol_event_emit(uint32_t event, void *data) "event=%d data=%p" monitor_protocol_event_emit(uint32_t event, void *data) "event=%d data=%p"
monitor_protocol_event_queue(uint32_t event, void *qdict, uint64_t rate) "event=%d data=%p rate=%" PRId64 monitor_protocol_event_queue(uint32_t event, void *qdict, uint64_t rate) "event=%d data=%p rate=%" PRId64
handle_hmp_command(void *mon, const char *cmdline) "mon %p cmdline: %s" handle_hmp_command(void *mon, const char *cmdline) "mon %p cmdline: %s"
handle_qmp_command(void *mon, const char *req) "mon %p req: %s"
# dma-helpers.c # dma-helpers.c
dma_blk_io(void *dbs, void *bs, int64_t offset, bool to_dev) "dbs=%p bs=%p offset=%" PRId64 " to_dev=%d" dma_blk_io(void *dbs, void *bs, int64_t offset, bool to_dev) "dbs=%p bs=%p offset=%" PRId64 " to_dev=%d"