[Spice-devel] [PATCH spice-server 3/3 v2] Trace streaming device data using recorder

Frediano Ziglio fziglio at redhat.com
Wed Dec 12 10:13:28 UTC 2018


Trace when data is received from the guest and when is sent
to the client.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 server/red-stream-device.c | 6 ++++++
 server/stream-channel.c    | 5 +++++
 2 files changed, 11 insertions(+)

diff --git a/server/red-stream-device.c b/server/red-stream-device.c
index 215ddbe7..3b553510 100644
--- a/server/red-stream-device.c
+++ b/server/red-stream-device.c
@@ -19,6 +19,8 @@
 #include <config.h>
 #endif
 
+#include <common/recorder.h>
+
 #include "red-stream-device.h"
 
 #include "stream-channel.h"
@@ -70,6 +72,8 @@ static StreamMsgHandler handle_msg_format, handle_msg_data, handle_msg_cursor_se
 static bool handle_msg_invalid(StreamDevice *dev, SpiceCharDeviceInstance *sin,
                                const char *error_msg) SPICE_GNUC_WARN_UNUSED_RESULT;
 
+RECORDER(stream_device_data, 32, "Stream device data packet");
+
 static void
 close_timer_func(void *opaque)
 {
@@ -324,6 +328,8 @@ handle_msg_data(StreamDevice *dev, SpiceCharDeviceInstance *sin)
      */
     if (dev->msg_pos == 0) {
         dev->frame_mmtime = reds_get_mm_time();
+        record(stream_device_data, "Stream data packet size %u mm_time %u",
+               dev->hdr.size, dev->frame_mmtime);
         if (dev->msg_len < dev->hdr.size) {
             g_free(dev->msg);
             dev->msg = g_malloc(dev->hdr.size);
diff --git a/server/stream-channel.c b/server/stream-channel.c
index c69c88d4..c38ee043 100644
--- a/server/stream-channel.c
+++ b/server/stream-channel.c
@@ -20,6 +20,7 @@
 #endif
 
 #include <common/generated_server_marshallers.h>
+#include <common/recorder.h>
 #include <spice/stream-device.h>
 
 #include "red-channel-client.h"
@@ -116,6 +117,8 @@ typedef struct StreamDataItem {
 
 static void stream_channel_client_on_disconnect(RedChannelClient *rcc);
 
+RECORDER(stream_channel_data, 32, "Stream channel data packet");
+
 static void
 stream_channel_client_class_init(StreamChannelClientClass *klass)
 {
@@ -289,6 +292,8 @@ stream_channel_send_item(RedChannelClient *rcc, RedPipeItem *pipe_item)
         red_pipe_item_ref(pipe_item);
         spice_marshaller_add_by_ref_full(m, item->data.data, item->data.data_size,
                                          marshaller_unref_pipe_item, pipe_item);
+        record(stream_channel_data, "Stream data packet size %u mm_time %u",
+               item->data.data_size, item->data.base.multi_media_time);
         break;
     }
     case RED_PIPE_ITEM_TYPE_STREAM_DESTROY: {
-- 
2.17.2



More information about the Spice-devel mailing list