mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2026-04-05 07:15:46 -04:00
debug: add timestamps when logging
Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
This commit is contained in:
parent
98da0a7b98
commit
a9ef785cf8
4 changed files with 23 additions and 13 deletions
|
|
@ -34,6 +34,7 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
#include "wayland-util.h"
|
#include "wayland-util.h"
|
||||||
#include "connection.h"
|
#include "connection.h"
|
||||||
|
|
@ -684,12 +685,23 @@ wl_closure_send(struct wl_closure *closure, struct wl_connection *connection)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
wl_closure_print(struct wl_closure *closure, struct wl_object *target)
|
wl_closure_print(struct wl_closure *closure, struct wl_object *target, int send)
|
||||||
{
|
{
|
||||||
union wl_value *value;
|
union wl_value *value;
|
||||||
|
char buffer[4] = "\0";
|
||||||
int i;
|
int i;
|
||||||
|
struct timespec tp;
|
||||||
|
unsigned int time;
|
||||||
|
|
||||||
fprintf(stderr, "%s@%d.%s(",
|
if (send)
|
||||||
|
sprintf(buffer, " -> ");
|
||||||
|
|
||||||
|
clock_gettime(CLOCK_REALTIME, &tp);
|
||||||
|
time = (tp.tv_sec * 1000000L) + (tp.tv_nsec / 1000);
|
||||||
|
|
||||||
|
fprintf(stderr, "[%10.3f] %s%s@%d.%s(",
|
||||||
|
time / 1000.0,
|
||||||
|
buffer,
|
||||||
target->interface->name, target->id,
|
target->interface->name, target->id,
|
||||||
closure->message->name);
|
closure->message->name);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ wl_closure_invoke(struct wl_closure *closure,
|
||||||
void
|
void
|
||||||
wl_closure_send(struct wl_closure *closure, struct wl_connection *connection);
|
wl_closure_send(struct wl_closure *closure, struct wl_connection *connection);
|
||||||
void
|
void
|
||||||
wl_closure_print(struct wl_closure *closure, struct wl_object *target);
|
wl_closure_print(struct wl_closure *closure, struct wl_object *target, int send);
|
||||||
void
|
void
|
||||||
wl_closure_destroy(struct wl_closure *closure);
|
wl_closure_destroy(struct wl_closure *closure);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdbool.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
@ -201,10 +202,8 @@ wl_proxy_marshal(struct wl_proxy *proxy, uint32_t opcode, ...)
|
||||||
|
|
||||||
wl_closure_send(closure, proxy->display->connection);
|
wl_closure_send(closure, proxy->display->connection);
|
||||||
|
|
||||||
if (wl_debug) {
|
if (wl_debug)
|
||||||
fprintf(stderr, " -> ");
|
wl_closure_print(closure, &proxy->object, true);
|
||||||
wl_closure_print(closure, &proxy->object);
|
|
||||||
}
|
|
||||||
|
|
||||||
wl_closure_destroy(closure);
|
wl_closure_destroy(closure);
|
||||||
}
|
}
|
||||||
|
|
@ -523,7 +522,7 @@ handle_event(struct wl_display *display,
|
||||||
size, display->objects, message);
|
size, display->objects, message);
|
||||||
|
|
||||||
if (wl_debug)
|
if (wl_debug)
|
||||||
wl_closure_print(closure, &proxy->object);
|
wl_closure_print(closure, &proxy->object, false);
|
||||||
|
|
||||||
wl_closure_invoke(closure, &proxy->object,
|
wl_closure_invoke(closure, &proxy->object,
|
||||||
proxy->object.implementation[opcode],
|
proxy->object.implementation[opcode],
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
#include <stdbool.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
@ -108,10 +109,8 @@ wl_client_post_event(struct wl_client *client, struct wl_object *sender,
|
||||||
|
|
||||||
wl_closure_send(closure, client->connection);
|
wl_closure_send(closure, client->connection);
|
||||||
|
|
||||||
if (wl_debug) {
|
if (wl_debug)
|
||||||
fprintf(stderr, " -> ");
|
wl_closure_print(closure, sender, true);
|
||||||
wl_closure_print(closure, sender);
|
|
||||||
}
|
|
||||||
|
|
||||||
wl_closure_destroy(closure);
|
wl_closure_destroy(closure);
|
||||||
}
|
}
|
||||||
|
|
@ -202,7 +201,7 @@ wl_client_connection_data(int fd, uint32_t mask, void *data)
|
||||||
|
|
||||||
|
|
||||||
if (wl_debug)
|
if (wl_debug)
|
||||||
wl_closure_print(closure, object);
|
wl_closure_print(closure, object, false);
|
||||||
|
|
||||||
wl_closure_invoke(closure, object,
|
wl_closure_invoke(closure, object,
|
||||||
object->implementation[opcode], client);
|
object->implementation[opcode], client);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue