[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/2] vmmouse: replace DPRINTF with tracing
From: |
marcandre . lureau |
Subject: |
[PATCH 1/2] vmmouse: replace DPRINTF with tracing |
Date: |
Tue, 1 Aug 2023 13:39:27 +0400 |
From: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
hw/i386/vmmouse.c | 29 ++++++++++++++---------------
hw/i386/trace-events | 10 ++++++++++
2 files changed, 24 insertions(+), 15 deletions(-)
diff --git a/hw/i386/vmmouse.c b/hw/i386/vmmouse.c
index a56c185f15..fce13a5cde 100644
--- a/hw/i386/vmmouse.c
+++ b/hw/i386/vmmouse.c
@@ -32,6 +32,8 @@
#include "cpu.h"
#include "qom/object.h"
+#include "trace.h"
+
/* debug only vmmouse */
//#define DEBUG_VMMOUSE
@@ -44,12 +46,6 @@
#define VMMOUSE_VERSION 0x3442554a
-#ifdef DEBUG_VMMOUSE
-#define DPRINTF(fmt, ...) printf(fmt, ## __VA_ARGS__)
-#else
-#define DPRINTF(fmt, ...) do { } while (0)
-#endif
-
#define TYPE_VMMOUSE "vmmouse"
OBJECT_DECLARE_SIMPLE_TYPE(VMMouseState, VMMOUSE)
@@ -87,7 +83,8 @@ static void vmmouse_set_data(const uint32_t *data)
static uint32_t vmmouse_get_status(VMMouseState *s)
{
- DPRINTF("vmmouse_get_status()\n");
+ trace_vmmouse_get_status();
+
return (s->status << 16) | s->nb_queue;
}
@@ -99,8 +96,7 @@ static void vmmouse_mouse_event(void *opaque, int x, int y,
int dz, int buttons_
if (s->nb_queue > (VMMOUSE_QUEUE_SIZE - 4))
return;
- DPRINTF("vmmouse_mouse_event(%d, %d, %d, %d)\n",
- x, y, dz, buttons_state);
+ trace_vmmouse_mouse_event(x, y, dz, buttons_state);
if ((buttons_state & MOUSE_EVENT_LBUTTON))
buttons |= 0x20;
@@ -151,7 +147,7 @@ static void vmmouse_update_handler(VMMouseState *s, int
absolute)
static void vmmouse_read_id(VMMouseState *s)
{
- DPRINTF("vmmouse_read_id()\n");
+ trace_vmmouse_read_id();
if (s->nb_queue == VMMOUSE_QUEUE_SIZE)
return;
@@ -163,19 +159,22 @@ static void vmmouse_read_id(VMMouseState *s)
static void vmmouse_request_relative(VMMouseState *s)
{
- DPRINTF("vmmouse_request_relative()\n");
+ trace_vmmouse_request_relative();
+
vmmouse_update_handler(s, 0);
}
static void vmmouse_request_absolute(VMMouseState *s)
{
- DPRINTF("vmmouse_request_absolute()\n");
+ trace_vmmouse_request_absolute();
+
vmmouse_update_handler(s, 1);
}
static void vmmouse_disable(VMMouseState *s)
{
- DPRINTF("vmmouse_disable()\n");
+ trace_vmmouse_disable();
+
s->status = 0xffff;
vmmouse_remove_handler(s);
}
@@ -184,7 +183,7 @@ static void vmmouse_data(VMMouseState *s, uint32_t *data,
uint32_t size)
{
int i;
- DPRINTF("vmmouse_data(%d)\n", size);
+ trace_vmmouse_data(size);
if (size == 0 || size > 6 || size > s->nb_queue) {
printf("vmmouse: driver requested too much data %d\n", size);
@@ -284,7 +283,7 @@ static void vmmouse_realizefn(DeviceState *dev, Error
**errp)
{
VMMouseState *s = VMMOUSE(dev);
- DPRINTF("vmmouse_init\n");
+ trace_vmmouse_init();
if (!s->i8042) {
error_setg(errp, "'i8042' link is not set");
diff --git a/hw/i386/trace-events b/hw/i386/trace-events
index 04fd71bfc4..53c02d7ac8 100644
--- a/hw/i386/trace-events
+++ b/hw/i386/trace-events
@@ -121,3 +121,13 @@ x86_pic_interrupt(int irqn, int level) "PIC interrupt #%d
level:%d"
# port92.c
port92_read(uint8_t val) "port92: read 0x%02x"
port92_write(uint8_t val) "port92: write 0x%02x"
+
+# vmmouse.c
+vmmouse_get_status(void) ""
+vmmouse_mouse_event(int x, int y, int dz, int buttons_state) "event: x=%d y=%d
dz=%d state=%d"
+vmmouse_init(void) ""
+vmmouse_read_id(void) ""
+vmmouse_request_relative(void) ""
+vmmouse_request_absolute(void) ""
+vmmouse_disable(void) ""
+vmmouse_data(uint32_t size) "data: size=%" PRIu32
--
2.41.0
- [PATCH 1/2] vmmouse: replace DPRINTF with tracing,
marcandre . lureau <=