Blob Blame History Raw
From 27bb458a2f95113b8c0e180ffcd43b618d165e0e Mon Sep 17 00:00:00 2001
From: Stefan Hajnoczi <stefanha@redhat.com>
Date: Fri, 16 Jun 2017 13:09:46 +0200
Subject: [PATCH 6/8] monitor: add handle_hmp_command trace event

RH-Author: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: <20170616130947.6577-2-stefanha@redhat.com>
Patchwork-id: 75624
O-Subject: [RHV-7.4 qemu-kvm-rhev PATCH 1/2] monitor: add handle_hmp_command trace event
Bugzilla: 1457740
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
RH-Acked-by: Markus Armbruster <armbru@redhat.com>

It is often useful to correlate QEMU-internal events with monitor
commands that caused them.  Trace the full HMP command being executed.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 20170605104216.22429-2-stefanha@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
(cherry picked from commit 79cad8b46ba79116ded5690ea2e265585bb9cb53)
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
 monitor.c    | 2 ++
 trace-events | 1 +
 2 files changed, 3 insertions(+)

diff --git a/monitor.c b/monitor.c
index d23f2eb..65b663e 100644
--- a/monitor.c
+++ b/monitor.c
@@ -3104,6 +3104,8 @@ static void handle_hmp_command(Monitor *mon, const char *cmdline)
     QDict *qdict;
     const mon_cmd_t *cmd;
 
+    trace_handle_hmp_command(mon, cmdline);
+
     cmd = monitor_parse_command(mon, &cmdline, mon->cmd_table);
     if (!cmd) {
         return;
diff --git a/trace-events b/trace-events
index bd54701..54e5301 100644
--- a/trace-events
+++ b/trace-events
@@ -68,6 +68,7 @@ xen_map_cache_return(void* ptr) "%p"
 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_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"
 
 # 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"
-- 
1.8.3.1