From bd4c3a728617211e7d5c94bda625433903396649 Mon Sep 17 00:00:00 2001 From: Andri Yngvason Date: Wed, 29 Jun 2022 11:47:04 +0000 Subject: [PATCH] Add dtrace probes for pts rects --- include/usdt.h | 31 +++++++++++++++++++++++++++++++ src/vnc.c | 5 +++++ 2 files changed, 36 insertions(+) create mode 100644 include/usdt.h diff --git a/include/usdt.h b/include/usdt.h new file mode 100644 index 0000000..2546a5b --- /dev/null +++ b/include/usdt.h @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2020 Andri Yngvason + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, + * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE + * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#pragma once + +#include "config.h" + +#ifdef HAVE_USDT +#include +#else +#define DTRACE_PROBE(...) +#define DTRACE_PROBE1(...) +#define DTRACE_PROBE2(...) +#define DTRACE_PROBE3(...) +#define DTRACE_PROBE4(...) +#define DTRACE_PROBE5(...) +#define DTRACE_PROBE6(...) +#endif diff --git a/src/vnc.c b/src/vnc.c index 57beaa1..a2ba7c6 100644 --- a/src/vnc.c +++ b/src/vnc.c @@ -27,6 +27,7 @@ #include "rfb/rfbclient.h" #include "vnc.h" #include "open-h264.h" +#include "usdt.h" #define RFB_ENCODING_OPEN_H264 50 #define RFB_ENCODING_PTS -1000 @@ -97,6 +98,8 @@ static void vnc_client_finish_update(rfbClient* client) struct vnc_client* self = rfbClientGetClientData(client, NULL); assert(self); + DTRACE_PROBE2(wlvncc, vnc_client_finish_update, client, self->pts); + self->update_fb(self); self->pts = NO_PTS; @@ -178,6 +181,8 @@ static rfbBool vnc_client_handle_pts_rect(rfbClient* client, self->pts = vnc_client_htonll(pts_msg); + DTRACE_PROBE1(wlvncc, vnc_client_handle_pts_rect, self->pts); + return TRUE; }