aboutsummaryrefslogtreecommitdiff
path: root/src/transport/plugin_transport_http_client.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2012-09-26 13:34:09 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2012-09-26 13:34:09 +0000
commit5a753cbdb8bcf30257ac96d3abb720671a2728fd (patch)
treec4fe806213db96bd2df0d342ce7aa9cb46538c78 /src/transport/plugin_transport_http_client.c
parentadb58602debdaa3d6ef84eea9570bea78437c2ec (diff)
downloadgnunet-5a753cbdb8bcf30257ac96d3abb720671a2728fd.tar.gz
gnunet-5a753cbdb8bcf30257ac96d3abb720671a2728fd.zip
- statistics values for all plugins
Diffstat (limited to 'src/transport/plugin_transport_http_client.c')
-rw-r--r--src/transport/plugin_transport_http_client.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/transport/plugin_transport_http_client.c b/src/transport/plugin_transport_http_client.c
index 212fb1b59..536e7382b 100644
--- a/src/transport/plugin_transport_http_client.c
+++ b/src/transport/plugin_transport_http_client.c
@@ -443,6 +443,7 @@ http_client_plugin_send (void *cls,
443{ 443{
444 struct HTTP_Client_Plugin *plugin = cls; 444 struct HTTP_Client_Plugin *plugin = cls;
445 struct HTTP_Message *msg; 445 struct HTTP_Message *msg;
446 char *stat_txt;
446 447
447 GNUNET_assert (plugin != NULL); 448 GNUNET_assert (plugin != NULL);
448 GNUNET_assert (s != NULL); 449 GNUNET_assert (s != NULL);
@@ -470,6 +471,12 @@ http_client_plugin_send (void *cls,
470 memcpy (msg->buf, msgbuf, msgbuf_size); 471 memcpy (msg->buf, msgbuf, msgbuf_size);
471 GNUNET_CONTAINER_DLL_insert_tail (s->msg_head, s->msg_tail, msg); 472 GNUNET_CONTAINER_DLL_insert_tail (s->msg_head, s->msg_tail, msg);
472 473
474 GNUNET_asprintf (&stat_txt, "# bytes currently in %s_client buffers", plugin->protocol);
475 GNUNET_STATISTICS_update (plugin->env->stats,
476 stat_txt, msgbuf_size, GNUNET_NO);
477
478 GNUNET_free (stat_txt);
479
473 if (GNUNET_YES == s->put_tmp_disconnecting) 480 if (GNUNET_YES == s->put_tmp_disconnecting)
474 { 481 {
475 /* PUT connection is currently getting disconnected */ 482 /* PUT connection is currently getting disconnected */
@@ -737,6 +744,7 @@ client_send_cb (void *stream, size_t size, size_t nmemb, void *cls)
737 struct HTTP_Client_Plugin *plugin = s->plugin; 744 struct HTTP_Client_Plugin *plugin = s->plugin;
738 struct HTTP_Message *msg = s->msg_head; 745 struct HTTP_Message *msg = s->msg_head;
739 size_t len; 746 size_t len;
747 char *stat_txt;
740 748
741 if (GNUNET_YES != client_exist_session (plugin, s)) 749 if (GNUNET_YES != client_exist_session (plugin, s))
742 { 750 {
@@ -779,6 +787,17 @@ client_send_cb (void *stream, size_t size, size_t nmemb, void *cls)
779 msg->transmit_cont (msg->transmit_cont_cls, &s->target, GNUNET_OK); 787 msg->transmit_cont (msg->transmit_cont_cls, &s->target, GNUNET_OK);
780 GNUNET_free (msg); 788 GNUNET_free (msg);
781 } 789 }
790
791 GNUNET_asprintf (&stat_txt, "# bytes currently in %s_client buffers", plugin->protocol);
792 GNUNET_STATISTICS_update (plugin->env->stats,
793 stat_txt, -len, GNUNET_NO);
794 GNUNET_free (stat_txt);
795
796 GNUNET_asprintf (&stat_txt, "# bytes transmitted via %s_client", plugin->protocol);
797 GNUNET_STATISTICS_update (plugin->env->stats,
798 stat_txt, len, GNUNET_NO);
799 GNUNET_free (stat_txt);
800
782 client_reschedule_session_timeout (s); 801 client_reschedule_session_timeout (s);
783 return len; 802 return len;
784} 803}
@@ -826,6 +845,7 @@ client_receive_mst_cb (void *cls, void *client,
826 struct HTTP_Client_Plugin *plugin; 845 struct HTTP_Client_Plugin *plugin;
827 struct GNUNET_TIME_Relative delay; 846 struct GNUNET_TIME_Relative delay;
828 struct GNUNET_ATS_Information atsi[2]; 847 struct GNUNET_ATS_Information atsi[2];
848 char *stat_txt;
829 if (GNUNET_YES != client_exist_session(p, s)) 849 if (GNUNET_YES != client_exist_session(p, s))
830 { 850 {
831 GNUNET_break (0); 851 GNUNET_break (0);
@@ -843,6 +863,11 @@ client_receive_mst_cb (void *cls, void *client,
843 (const struct GNUNET_ATS_Information *) &atsi, 2, 863 (const struct GNUNET_ATS_Information *) &atsi, 2,
844 s, s->addr, s->addrlen); 864 s, s->addr, s->addrlen);
845 865
866 GNUNET_asprintf (&stat_txt, "# bytes received via %s_client", plugin->protocol);
867 GNUNET_STATISTICS_update (plugin->env->stats,
868 stat_txt, ntohs(message->size), GNUNET_NO);
869 GNUNET_free (stat_txt);
870
846 s->next_receive = 871 s->next_receive =
847 GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get (), delay); 872 GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get (), delay);
848 873