Patchwork [2/3] trace: trace monitor qmp dispatch/completion

login
register
mail settings
Submitter Stefan Hajnoczi
Date Sept. 30, 2011, 4:51 p.m.
Message ID <1317401463-7800-3-git-send-email-stefanha@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/117166/
State New
Headers show

Comments

Stefan Hajnoczi - Sept. 30, 2011, 4:51 p.m.
Add trace events for handle_qmp_command(), which dispatches qmp
commands, and monitor_protocol_emitter(), which produces the reply to a
qmp command.

Also remove duplicate #include "trace/control.h".

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
---
 monitor.c    |    5 ++++-
 trace-events |    4 ++++
 2 files changed, 8 insertions(+), 1 deletions(-)

Patch

diff --git a/monitor.c b/monitor.c
index 8ec2c5e..0bb88e9 100644
--- a/monitor.c
+++ b/monitor.c
@@ -57,11 +57,11 @@ 
 #include "json-parser.h"
 #include "osdep.h"
 #include "cpu.h"
+#include "trace.h"
 #include "trace/control.h"
 #ifdef CONFIG_TRACE_SIMPLE
 #include "trace/simple.h"
 #endif
-#include "trace/control.h"
 #include "ui/qemu-spice.h"
 
 //#define DEBUG
@@ -369,6 +369,8 @@  static void monitor_protocol_emitter(Monitor *mon, QObject *data)
 {
     QDict *qmp;
 
+    trace_monitor_protocol_emitter(mon);
+
     qmp = qdict_new();
 
     if (!monitor_has_error(mon)) {
@@ -5089,6 +5091,7 @@  static void handle_qmp_command(JSONMessageParser *parser, QList *tokens)
     qobject_incref(mon->mc->id);
 
     cmd_name = qdict_get_str(input, "execute");
+    trace_handle_qmp_command(mon, cmd_name);
     if (invalid_qmp_mode(mon, cmd_name)) {
         qerror_report(QERR_COMMAND_NOT_FOUND, cmd_name);
         goto err_out;
diff --git a/trace-events b/trace-events
index 79ff5ea..b982727 100644
--- a/trace-events
+++ b/trace-events
@@ -503,3 +503,7 @@  escc_sunkbd_event_in(int ch) "Untranslated keycode %2.2x"
 escc_sunkbd_event_out(int ch) "Translated keycode %2.2x"
 escc_kbd_command(int val) "Command %d"
 escc_sunmouse_event(int dx, int dy, int buttons_state) "dx=%d dy=%d buttons=%01x"
+
+# monitor.c
+handle_qmp_command(void *mon, const char *cmd_name) "mon %p cmd_name \"%s\""
+monitor_protocol_emitter(void *mon) "mon %p"