From d02e4fa4a8e180c0a312b7c520a167894a0c8a83 Mon Sep 17 00:00:00 2001 From: Amit Shah Date: Tue, 5 Jul 2011 16:37:49 +0530 Subject: virtio-console: Add some trace events Add some trace events for messages passed between the char layer and the virtio-serial bus. Signed-off-by: Amit Shah --- hw/virtio-console.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'hw/virtio-console.c') diff --git a/hw/virtio-console.c b/hw/virtio-console.c index b076331d37..713a761dfa 100644 --- a/hw/virtio-console.c +++ b/hw/virtio-console.c @@ -12,6 +12,7 @@ #include "qemu-char.h" #include "qemu-error.h" +#include "trace.h" #include "virtio-serial.h" typedef struct VirtConsole { @@ -24,8 +25,12 @@ typedef struct VirtConsole { static ssize_t flush_buf(VirtIOSerialPort *port, const uint8_t *buf, size_t len) { VirtConsole *vcon = DO_UPCAST(VirtConsole, port, port); + ssize_t ret; - return qemu_chr_write(vcon->chr, buf, len); + ret = qemu_chr_write(vcon->chr, buf, len); + + trace_virtio_console_flush_buf(port->id, len, ret); + return ret; } /* Callback function that's called when the guest opens the port */ @@ -57,6 +62,7 @@ static void chr_read(void *opaque, const uint8_t *buf, int size) { VirtConsole *vcon = opaque; + trace_virtio_console_chr_read(vcon->port.id, size); virtio_serial_write(&vcon->port, buf, size); } @@ -64,6 +70,7 @@ static void chr_event(void *opaque, int event) { VirtConsole *vcon = opaque; + trace_virtio_console_chr_event(vcon->port.id, event); switch (event) { case CHR_EVENT_OPENED: virtio_serial_open(&vcon->port); -- cgit v1.2.3