Skip to contentSkip to conversation

Tracing patches

GIT PULL New Stefan Hajnoczi 2 participants 6 messages Oct 3, 2011 – Oct 8, 2011

lore
Share & tools
lore
#1 lore raw

PATCH 1/4 hmp: re-enable trace-file command

In reply to Stefan Hajnoczi

From: Michael Roth <[email protected]>

Commit 31965ae27bc11e90674be12584bb201b83df5aef reverted a previous renaming of CONFIG_SIMPLE_TRACE->CONFIG_TRACE_SIMPLE in a couple spots, leading to trace-file currently being unavailable.

---
 hmp-commands.hx |    2 +-
 monitor.c       |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
hmp-commands.hx +1 -1
index 9e1cca8..844e6c9 100644
@@ -194,7 +194,7 @@ STEXI
 changes status of a trace event
 ETEXI
 
-#if defined(CONFIG_SIMPLE_TRACE)
+#if defined(CONFIG_TRACE_SIMPLE)
     {
         .name       = "trace-file",
         .args_type  = "op:s?,arg:F?",
monitor.c +1 -1
index d323ea5..08f6197 100644
@@ -606,7 +606,7 @@ static void do_trace_event_set_state(Monitor *mon, const QDict *qdict)
     }
 }
 
-#ifdef CONFIG_SIMPLE_TRACE
+#ifdef CONFIG_TRACE_SIMPLE
 static void do_trace_file(Monitor *mon, const QDict *qdict)
 {
     const char *op = qdict_get_try_str(qdict, "op");
Signature · 1 line
1.7.6.3
#0 lore raw

The following changes since commit d11cf8cc80d946dfc9a23597cd9a0bb1c487cfa7:

etrax-dma: Remove bogus if statement (2011-10-03 10:20:13 +0200)

are available in the git repository at:
ssh://repo.or.cz/srv/git/qemu/stefanha.git tracing

Michael Roth (1):
hmp: re-enable trace-file command

Stefan Hajnoczi (3):
trace: trace bdrv_open_common()
trace: trace monitor qmp dispatch/completion
trace: add arguments to bdrv_co_io_em() trace event

 block.c         |    4 +++-
 hmp-commands.hx |    2 +-
 monitor.c       |    7 +++++--
 trace-events    |    7 ++++++-
 4 files changed, 15 insertions(+), 5 deletions(-)
Signature · 1 line
1.7.6.3
#3 lore raw

PATCH 3/4 trace: trace monitor qmp dispatch/completion

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".

---
 monitor.c    |    5 ++++-
 trace-events |    4 ++++
 2 files changed, 8 insertions(+), 1 deletions(-)
monitor.c +4 -1
index 08f6197..cf59442 100644
@@ -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"
 #include "memory.h"
 
@@ -370,6 +370,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)) {
@@ -5102,6 +5104,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;
trace-events +4 -0
index f408564..c9fd8e5 100644
@@ -534,3 +534,7 @@ esp_mem_writeb_cmd_sel(uint32_t val) "Select without ATN (%2.2x)"
 esp_mem_writeb_cmd_selatn(uint32_t val) "Select with ATN (%2.2x)"
 esp_mem_writeb_cmd_selatns(uint32_t val) "Select with ATN & stop (%2.2x)"
 esp_mem_writeb_cmd_ensel(uint32_t val) "Enable selection (%2.2x)"
+
+# monitor.c
+handle_qmp_command(void *mon, const char *cmd_name) "mon %p cmd_name \"%s\""
+monitor_protocol_emitter(void *mon) "mon %p"
Signature · 1 line
1.7.6.3
#2 lore raw

PATCH 2/4 trace: trace bdrv_open_common()

In reply to Stefan Hajnoczi

bdrv_open_common() is a useful point to trace since it reveals the filename and block driver for a given BlockDriverState.

---
 block.c      |    2 ++
 trace-events |    1 +
 2 files changed, 3 insertions(+), 0 deletions(-)
block.c +2 -0
index e3fe97f..1ae22d5 100644
@@ -475,6 +475,8 @@ static int bdrv_open_common(BlockDriverState *bs, const char *filename,
 
     assert(drv != NULL);
 
+    trace_bdrv_open_common(bs, filename, flags, drv->format_name);
+
     bs->file = NULL;
     bs->total_sectors = 0;
     bs->encrypted = 0;
trace-events +1 -0
index b7ddf14..f408564 100644
@@ -56,6 +56,7 @@ virtio_console_chr_read(unsigned int port, int size) "port %u, size %d"
 virtio_console_chr_event(unsigned int port, int event) "port %u, event %d"
 
 # block.c
+bdrv_open_common(void *bs, const char *filename, int flags, const char *format_name) "bs %p filename \"%s\" flags %#x format_name \"%s\""
 multiwrite_cb(void *mcb, int ret) "mcb %p ret %d"
 bdrv_aio_multiwrite(void *mcb, int num_callbacks, int num_reqs) "mcb %p num_callbacks %d num_reqs %d"
 bdrv_aio_multiwrite_earlyfail(void *mcb) "mcb %p"
Signature · 1 line
1.7.6.3
#4 lore raw

PATCH 4/4 trace: add arguments to bdrv_co_io_em() trace event

In reply to Stefan Hajnoczi

It is useful to know the BlockDriverState as well as the sector_num/nb_sectors of an emulated .bdrv_co_*() request.

---
 block.c      |    2 +-
 trace-events |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
block.c +1 -1
index 1ae22d5..e865fab 100644
@@ -2999,7 +2999,7 @@ static int coroutine_fn bdrv_co_io_em(BlockDriverState *bs, int64_t sector_num,
                              bdrv_co_io_em_complete, &co);
     }
 
-    trace_bdrv_co_io(is_write, acb);
+    trace_bdrv_co_io_em(bs, sector_num, nb_sectors, is_write, acb);
     if (!acb) {
         return -EIO;
     }
trace-events +1 -1
index c9fd8e5..9528c04 100644
@@ -67,7 +67,7 @@ bdrv_aio_writev(void *bs, int64_t sector_num, int nb_sectors, void *opaque) "bs
 bdrv_lock_medium(void *bs, bool locked) "bs %p locked %d"
 bdrv_co_readv(void *bs, int64_t sector_num, int nb_sector) "bs %p sector_num %"PRId64" nb_sectors %d"
 bdrv_co_writev(void *bs, int64_t sector_num, int nb_sector) "bs %p sector_num %"PRId64" nb_sectors %d"
-bdrv_co_io(int is_write, void *acb) "is_write %d acb %p"
+bdrv_co_io_em(void *bs, int64_t sector_num, int nb_sectors, int is_write, void *acb) "bs %p sector_num %"PRId64" nb_sectors %d is_write %d acb %p"
 
 # hw/virtio-blk.c
 virtio_blk_req_complete(void *req, int status) "req %p status %d"
Signature · 1 line
1.7.6.3
#5 lore raw
In reply to Stefan Hajnoczi
Quoted 6 lines · Stefan Hajnoczi

The following changes since commit d11cf8cc80d946dfc9a23597cd9a0bb1c487cfa7:

 etrax-dma: Remove bogus if statement (2011-10-03 10:20:13 +0200)

are available in the git repository at:
 ssh://repo.or.cz/srv/git/qemu/stefanha.git tracing

Thanks, pulled.

Quoted 19 lines

Michael Roth (1):
     hmp: re-enable trace-file command

Stefan Hajnoczi (3):
     trace: trace bdrv_open_common()
     trace: trace monitor qmp dispatch/completion
     trace: add arguments to bdrv_co_io_em() trace event

 block.c         |    4 +++-
 hmp-commands.hx |    2 +-
 monitor.c       |    7 +++++--
 trace-events    |    7 ++++++-

 4 files changed, 15 insertions(+), 5 deletions(-)

--
1.7.6.3