add logging to watch for transmission delays within transport service
authorChristian Grothoff <christian@grothoff.org>
Sat, 17 Oct 2015 19:43:02 +0000 (19:43 +0000)
committerChristian Grothoff <christian@grothoff.org>
Sat, 17 Oct 2015 19:43:02 +0000 (19:43 +0000)
src/transport/gnunet-service-transport_clients.c

index 3533b5f6d5f5327454788c7ba873ff5e901b4e95..12a5dc5574546e7e1b424fe239016242982ee67f 100644 (file)
@@ -688,6 +688,11 @@ struct SendTransmitContinuationContext
    * Peer that was the target.
    */
   struct GNUNET_PeerIdentity target;
+
+  /**
+   * At what time did we receive the message?
+   */
+  struct GNUNET_TIME_Absolute send_time;
 };
 
 
@@ -708,6 +713,27 @@ handle_send_transmit_continuation (void *cls,
 {
   struct SendTransmitContinuationContext *stcc = cls;
   struct SendOkMessage send_ok_msg;
+  struct GNUNET_TIME_Relative delay;
+
+  delay = GNUNET_TIME_absolute_get_duration (stcc->send_time);
+  if (delay.rel_value_us > GNUNET_CONSTANTS_LATENCY_WARN.rel_value_us)
+    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                "It took us %s to send %u/%u bytes to %s (%d)\n",
+                GNUNET_STRINGS_relative_time_to_string (delay,
+                                                        GNUNET_YES),
+                (unsigned int) bytes_payload,
+                (unsigned int) bytes_on_wire,
+                GNUNET_i2s (&stcc->target),
+                success);
+  else
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "It took us %s to send %u/%u bytes to %s (%d)\n",
+                GNUNET_STRINGS_relative_time_to_string (delay,
+                                                        GNUNET_YES),
+                (unsigned int) bytes_payload,
+                (unsigned int) bytes_on_wire,
+                GNUNET_i2s (&stcc->target),
+                success);
 
   if (GST_neighbours_test_connected (&stcc->target))
   {
@@ -800,6 +826,7 @@ clients_handle_send (void *cls,
   stcc = GNUNET_new (struct SendTransmitContinuationContext);
   stcc->target = obm->peer;
   stcc->client = client;
+  stcc->send_time = GNUNET_TIME_absolute_get ();
   GNUNET_SERVER_client_keep (client);
   GST_manipulation_send (&obm->peer,
                          obmm,