]> git.proxmox.com Git - qemu.git/commitdiff
virtio-console: Add some trace events
authorAmit Shah <amit.shah@redhat.com>
Tue, 5 Jul 2011 11:07:49 +0000 (16:37 +0530)
committerAmit Shah <amit.shah@redhat.com>
Mon, 18 Jul 2011 10:00:14 +0000 (15:30 +0530)
Add some trace events for messages passed between the char layer and the
virtio-serial bus.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
hw/virtio-console.c
trace-events

index b076331d379ec60c8be9f0063cd27fda90d2e581..713a761dfa8a7c90f2dbe5db8a07c026fc8a24ed 100644 (file)
@@ -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);
index 59420e8a6e4c4120d8e5c08e4ee97ce08bd4d746..765a15ed77cfb8aca0101773d53530ee33f3ffd9 100644 (file)
@@ -52,6 +52,11 @@ disable virtio_serial_throttle_port(unsigned int port, bool throttle) "port %u,
 disable virtio_serial_handle_control_message(uint16_t event, uint16_t value) "event %u, value %u"
 disable virtio_serial_handle_control_message_port(unsigned int port) "port %u"
 
+# hw/virtio-console.c
+disable virtio_console_flush_buf(unsigned int port, size_t len, ssize_t ret) "port %u, in_len %zu, out_len %zd"
+disable virtio_console_chr_read(unsigned int port, int size) "port %u, size %d"
+disable virtio_console_chr_event(unsigned int port, int event) "port %u, event %d"
+
 # block.c
 disable multiwrite_cb(void *mcb, int ret) "mcb %p ret %d"
 disable bdrv_aio_multiwrite(void *mcb, int num_callbacks, int num_reqs) "mcb %p num_callbacks %d num_reqs %d"