gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r24015 - gnunet/src/transport


From: gnunet
Subject: [GNUnet-SVN] r24015 - gnunet/src/transport
Date: Wed, 26 Sep 2012 15:34:09 +0200

Author: wachs
Date: 2012-09-26 15:34:09 +0200 (Wed, 26 Sep 2012)
New Revision: 24015

Modified:
   gnunet/src/transport/plugin_transport_http_client.c
   gnunet/src/transport/plugin_transport_http_server.c
   gnunet/src/transport/plugin_transport_udp.c
Log:
- statistics values for all plugins

Modified: gnunet/src/transport/plugin_transport_http_client.c
===================================================================
--- gnunet/src/transport/plugin_transport_http_client.c 2012-09-26 13:29:03 UTC 
(rev 24014)
+++ gnunet/src/transport/plugin_transport_http_client.c 2012-09-26 13:34:09 UTC 
(rev 24015)
@@ -443,6 +443,7 @@
 {
   struct HTTP_Client_Plugin *plugin = cls;
   struct HTTP_Message *msg;
+  char *stat_txt;
 
   GNUNET_assert (plugin != NULL);
   GNUNET_assert (s != NULL);
@@ -470,6 +471,12 @@
   memcpy (msg->buf, msgbuf, msgbuf_size);
   GNUNET_CONTAINER_DLL_insert_tail (s->msg_head, s->msg_tail, msg);
 
+  GNUNET_asprintf (&stat_txt, "# bytes currently in %s_client buffers", 
plugin->protocol);
+  GNUNET_STATISTICS_update (plugin->env->stats,
+                            stat_txt, msgbuf_size, GNUNET_NO);
+
+  GNUNET_free (stat_txt);
+
   if (GNUNET_YES == s->put_tmp_disconnecting)
   {
     /* PUT connection is currently getting disconnected */
@@ -737,6 +744,7 @@
   struct HTTP_Client_Plugin *plugin = s->plugin;
   struct HTTP_Message *msg = s->msg_head;
   size_t len;
+  char *stat_txt;
 
   if (GNUNET_YES != client_exist_session (plugin, s))
   {
@@ -779,6 +787,17 @@
       msg->transmit_cont (msg->transmit_cont_cls, &s->target, GNUNET_OK);
     GNUNET_free (msg);
   }
+
+  GNUNET_asprintf (&stat_txt, "# bytes currently in %s_client buffers", 
plugin->protocol);
+  GNUNET_STATISTICS_update (plugin->env->stats,
+                            stat_txt, -len, GNUNET_NO);
+  GNUNET_free (stat_txt);
+
+  GNUNET_asprintf (&stat_txt, "# bytes transmitted via %s_client", 
plugin->protocol);
+  GNUNET_STATISTICS_update (plugin->env->stats,
+                            stat_txt, len, GNUNET_NO);
+  GNUNET_free (stat_txt);
+
   client_reschedule_session_timeout (s);
   return len;
 }
@@ -826,6 +845,7 @@
   struct HTTP_Client_Plugin *plugin;
   struct GNUNET_TIME_Relative delay;
   struct GNUNET_ATS_Information atsi[2];
+  char *stat_txt;
   if (GNUNET_YES != client_exist_session(p, s))
   {
     GNUNET_break (0);
@@ -843,6 +863,11 @@
                                    (const struct GNUNET_ATS_Information *) 
&atsi, 2,
                                    s, s->addr, s->addrlen);
 
+  GNUNET_asprintf (&stat_txt, "# bytes received via %s_client", 
plugin->protocol);
+  GNUNET_STATISTICS_update (plugin->env->stats,
+                            stat_txt, ntohs(message->size), GNUNET_NO);
+  GNUNET_free (stat_txt);
+
   s->next_receive =
       GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get (), delay);
 

Modified: gnunet/src/transport/plugin_transport_http_server.c
===================================================================
--- gnunet/src/transport/plugin_transport_http_server.c 2012-09-26 13:29:03 UTC 
(rev 24014)
+++ gnunet/src/transport/plugin_transport_http_server.c 2012-09-26 13:34:09 UTC 
(rev 24015)
@@ -510,6 +510,7 @@
   struct HTTP_Server_Plugin *plugin = cls;
   struct HTTP_Message *msg;
   int bytes_sent = 0;
+  char *stat_txt;
 
   GNUNET_assert (plugin != NULL);
   GNUNET_assert (session != NULL);
@@ -547,6 +548,11 @@
 
   GNUNET_CONTAINER_DLL_insert_tail (session->msg_head, session->msg_tail, msg);
 
+  GNUNET_asprintf (&stat_txt, "# bytes currently in %s_server buffers", 
plugin->protocol);
+  GNUNET_STATISTICS_update (plugin->env->stats,
+                            stat_txt, msgbuf_size, GNUNET_NO);
+  GNUNET_free (stat_txt);
+
   server_reschedule (session->plugin, session->server_send->mhd_daemon, 
GNUNET_YES);
   server_reschedule_session_timeout (session);
 
@@ -1170,6 +1176,7 @@
   struct Session *s = cls;
   ssize_t bytes_read = 0;
   struct HTTP_Message *msg;
+  char *stat_txt;
 
   GNUNET_assert (NULL != p);
   if (GNUNET_NO == server_exist_session (p, s))
@@ -1193,8 +1200,18 @@
     }
   }
   if (0 < bytes_read)
+  {
     GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, s->plugin->name,
                    "Sent %u bytes to peer `%s' with session %p \n", 
bytes_read, GNUNET_i2s (&s->target), s);
+    GNUNET_asprintf (&stat_txt, "# bytes currently in %s_server buffers", 
p->protocol);
+    GNUNET_STATISTICS_update (p->env->stats,
+                              stat_txt, -bytes_read, GNUNET_NO);
+    GNUNET_free (stat_txt);
+    GNUNET_asprintf (&stat_txt, "# bytes transmitted via %s_server", 
p->protocol);
+    GNUNET_STATISTICS_update (p->env->stats,
+                              stat_txt, bytes_read, GNUNET_NO);
+    GNUNET_free (stat_txt);
+  }
   return bytes_read;
 }
 
@@ -1214,6 +1231,7 @@
   struct Session *s = cls;
   struct GNUNET_ATS_Information atsi[2];
   struct GNUNET_TIME_Relative delay;
+  char *stat_txt;
 
   GNUNET_assert (NULL != p);
   if (GNUNET_NO == server_exist_session(p, s))
@@ -1227,11 +1245,18 @@
   atsi[1].value = s->ats_address_network_type;
   GNUNET_break (s->ats_address_network_type != ntohl 
(GNUNET_ATS_NET_UNSPECIFIED));
 
+
   delay = plugin->env->receive (plugin->env->cls,
                                 &s->target,
                                 message,
                                 (const struct GNUNET_ATS_Information *) &atsi, 
2,
                                 s, s->addr, s->addrlen);
+
+  GNUNET_asprintf (&stat_txt, "# bytes received via %s_server", 
plugin->protocol);
+  GNUNET_STATISTICS_update (plugin->env->stats,
+                            stat_txt, ntohs (message->size), GNUNET_NO);
+  GNUNET_free (stat_txt);
+
   s->session_passed = GNUNET_YES;
   s->next_receive = GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get (), 
delay);
   if (delay.rel_value > 0)

Modified: gnunet/src/transport/plugin_transport_udp.c
===================================================================
--- gnunet/src/transport/plugin_transport_udp.c 2012-09-26 13:29:03 UTC (rev 
24014)
+++ gnunet/src/transport/plugin_transport_udp.c 2012-09-26 13:34:09 UTC (rev 
24015)
@@ -1233,6 +1233,10 @@
        GNUNET_i2s (&s->target),
        GNUNET_a2s(s->sock_addr, s->addrlen));
   
+  GNUNET_STATISTICS_update (plugin->env->stats,
+                            "# bytes currently in UDP buffers",
+                            msgbuf_size, GNUNET_NO);
+
   /* Message */
   udp = (struct UDPMessage *) mbuf;
   udp->header.size = htons (mlen);
@@ -1816,6 +1820,10 @@
     return;
   }
 
+  GNUNET_STATISTICS_update (plugin->env->stats,
+                            "# bytes received via UDP",
+                            size, GNUNET_NO);
+
   switch (ntohs (msg->type))
   {
   case GNUNET_MESSAGE_TYPE_TRANSPORT_BROADCAST_BEACON:
@@ -1867,7 +1875,7 @@
   const struct sockaddr * sa = udpw->session->sock_addr;
   slen = udpw->session->addrlen;
 
-  max = GNUNET_TIME_absolute_max(udpw->timeout, GNUNET_TIME_absolute_get());
+  max = GNUNET_TIME_absolute_max (udpw->timeout, GNUNET_TIME_absolute_get());
 
   while (udpw != NULL)
   {
@@ -1880,7 +1888,7 @@
         LOG (GNUNET_ERROR_TYPE_DEBUG,
             "Fragmented message for peer `%s' with size %u timed out\n",
             GNUNET_i2s(&udpw->session->target), udpw->frag_ctx->bytes_to_send);
-        udpw->session->last_expected_delay = 
GNUNET_FRAGMENT_context_destroy(udpw->frag_ctx->frag);
+        udpw->session->last_expected_delay = GNUNET_FRAGMENT_context_destroy 
(udpw->frag_ctx->frag);
         GNUNET_free (udpw->frag_ctx);
         udpw->session->frag_ctx = NULL;
       }
@@ -1985,10 +1993,17 @@
          "UDP transmitted %u-byte message to `%s' (%d: %s)\n",
          (unsigned int) (udpw->msg_size), GNUNET_a2s (sa, slen), (int) sent,
          (sent < 0) ? STRERROR (errno) : "ok");
+    GNUNET_STATISTICS_update (plugin->env->stats,
+                              "# bytes transmitted via UDP",
+                              sent, GNUNET_NO);
     call_continuation(udpw, GNUNET_OK);
     network_down_error = GNUNET_NO;
   }
 
+  GNUNET_STATISTICS_update (plugin->env->stats,
+                            "# bytes currently in UDP buffers",
+                            -udpw->msg_size, GNUNET_NO);
+
   if (sock == plugin->sockv4)
     GNUNET_CONTAINER_DLL_remove(plugin->ipv4_queue_head, 
plugin->ipv4_queue_tail, udpw);
   else if (sock == plugin->sockv6)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]