From 85a44bb14cabc25ceb8c60c693781352de4998d7 Mon Sep 17 00:00:00 2001
Message-Id: <85a44bb14cabc25ceb8c60c693781352de4998d7.1368111914.git.minovotn@redhat.com>
In-Reply-To: <405603258af5154387bea676be1f904b6713f6ae.1368111913.git.minovotn@redhat.com>
References: <405603258af5154387bea676be1f904b6713f6ae.1368111913.git.minovotn@redhat.com>
From: Amit Shah <amit.shah@redhat.com>
Date: Wed, 24 Apr 2013 08:18:19 +0200
Subject: [PATCH 45/65] virtio-console: Add some trace events

RH-Author: Amit Shah <amit.shah@redhat.com>
Message-id: <da05f43331f3084b5094dde7acbde320bc4eda08.1366724981.git.amit.shah@redhat.com>
Patchwork-id: 50823
O-Subject: [RHEL6.5 qemu-kvm PATCH 45/65] virtio-console: Add some trace events
Bugzilla: 909059
RH-Acked-by: Hans de Goede <hdegoede@redhat.com>
RH-Acked-by: Gerd Hoffmann <kraxel@redhat.com>
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>

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>
(cherry picked from commit d02e4fa4a8e180c0a312b7c520a167894a0c8a83)

Signed-off-by: Amit Shah <amit.shah@redhat.com>

Conflicts:
	hw/virtio-console.c
	trace-events
---
 hw/virtio-console.c | 4 ++++
 trace-events        | 5 +++++
 2 files changed, 9 insertions(+)

Signed-off-by: Michal Novotny <minovotn@redhat.com>
---
 hw/virtio-console.c | 4 ++++
 trace-events        | 5 +++++
 2 files changed, 9 insertions(+)

diff --git a/hw/virtio-console.c b/hw/virtio-console.c
index 06b4303..72fc1b1 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 {
@@ -43,6 +44,7 @@ static ssize_t flush_buf(VirtIOSerialPort *port, const uint8_t *buf, size_t len)
         return len;
     }
     ret = qemu_chr_fe_write(vcon->chr, buf, len);
+    trace_virtio_console_flush_buf(port->id, len, ret);
 
     if (ret <= 0) {
         VirtIOSerialPortInfo *info = DO_UPCAST(VirtIOSerialPortInfo, qdev,
@@ -99,6 +101,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);
 }
 
@@ -106,6 +109,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);
diff --git a/trace-events b/trace-events
index 94e999c..071c659 100644
--- a/trace-events
+++ b/trace-events
@@ -46,6 +46,11 @@ disable virtio_queue_notify(void *vdev, int n, void *vq) "vdev %p n %d vq %p"
 disable virtio_irq(void *vq) "vq %p"
 disable virtio_notify(void *vdev, void *vq) "vdev %p vq %p"
 
+# 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"
-- 
1.7.11.7

