diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2012-09-26 13:34:09 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2012-09-26 13:34:09 +0000 |
commit | 5a753cbdb8bcf30257ac96d3abb720671a2728fd (patch) | |
tree | c4fe806213db96bd2df0d342ce7aa9cb46538c78 /src/transport/plugin_transport_http_server.c | |
parent | adb58602debdaa3d6ef84eea9570bea78437c2ec (diff) | |
download | gnunet-5a753cbdb8bcf30257ac96d3abb720671a2728fd.tar.gz gnunet-5a753cbdb8bcf30257ac96d3abb720671a2728fd.zip |
- statistics values for all plugins
Diffstat (limited to 'src/transport/plugin_transport_http_server.c')
-rw-r--r-- | src/transport/plugin_transport_http_server.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/transport/plugin_transport_http_server.c b/src/transport/plugin_transport_http_server.c index 19df500bd..ea8ef428f 100644 --- a/src/transport/plugin_transport_http_server.c +++ b/src/transport/plugin_transport_http_server.c | |||
@@ -510,6 +510,7 @@ http_server_plugin_send (void *cls, | |||
510 | struct HTTP_Server_Plugin *plugin = cls; | 510 | struct HTTP_Server_Plugin *plugin = cls; |
511 | struct HTTP_Message *msg; | 511 | struct HTTP_Message *msg; |
512 | int bytes_sent = 0; | 512 | int bytes_sent = 0; |
513 | char *stat_txt; | ||
513 | 514 | ||
514 | GNUNET_assert (plugin != NULL); | 515 | GNUNET_assert (plugin != NULL); |
515 | GNUNET_assert (session != NULL); | 516 | GNUNET_assert (session != NULL); |
@@ -547,6 +548,11 @@ http_server_plugin_send (void *cls, | |||
547 | 548 | ||
548 | GNUNET_CONTAINER_DLL_insert_tail (session->msg_head, session->msg_tail, msg); | 549 | GNUNET_CONTAINER_DLL_insert_tail (session->msg_head, session->msg_tail, msg); |
549 | 550 | ||
551 | GNUNET_asprintf (&stat_txt, "# bytes currently in %s_server buffers", plugin->protocol); | ||
552 | GNUNET_STATISTICS_update (plugin->env->stats, | ||
553 | stat_txt, msgbuf_size, GNUNET_NO); | ||
554 | GNUNET_free (stat_txt); | ||
555 | |||
550 | server_reschedule (session->plugin, session->server_send->mhd_daemon, GNUNET_YES); | 556 | server_reschedule (session->plugin, session->server_send->mhd_daemon, GNUNET_YES); |
551 | server_reschedule_session_timeout (session); | 557 | server_reschedule_session_timeout (session); |
552 | 558 | ||
@@ -1170,6 +1176,7 @@ server_send_callback (void *cls, uint64_t pos, char *buf, size_t max) | |||
1170 | struct Session *s = cls; | 1176 | struct Session *s = cls; |
1171 | ssize_t bytes_read = 0; | 1177 | ssize_t bytes_read = 0; |
1172 | struct HTTP_Message *msg; | 1178 | struct HTTP_Message *msg; |
1179 | char *stat_txt; | ||
1173 | 1180 | ||
1174 | GNUNET_assert (NULL != p); | 1181 | GNUNET_assert (NULL != p); |
1175 | if (GNUNET_NO == server_exist_session (p, s)) | 1182 | if (GNUNET_NO == server_exist_session (p, s)) |
@@ -1193,8 +1200,18 @@ server_send_callback (void *cls, uint64_t pos, char *buf, size_t max) | |||
1193 | } | 1200 | } |
1194 | } | 1201 | } |
1195 | if (0 < bytes_read) | 1202 | if (0 < bytes_read) |
1203 | { | ||
1196 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, s->plugin->name, | 1204 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, s->plugin->name, |
1197 | "Sent %u bytes to peer `%s' with session %p \n", bytes_read, GNUNET_i2s (&s->target), s); | 1205 | "Sent %u bytes to peer `%s' with session %p \n", bytes_read, GNUNET_i2s (&s->target), s); |
1206 | GNUNET_asprintf (&stat_txt, "# bytes currently in %s_server buffers", p->protocol); | ||
1207 | GNUNET_STATISTICS_update (p->env->stats, | ||
1208 | stat_txt, -bytes_read, GNUNET_NO); | ||
1209 | GNUNET_free (stat_txt); | ||
1210 | GNUNET_asprintf (&stat_txt, "# bytes transmitted via %s_server", p->protocol); | ||
1211 | GNUNET_STATISTICS_update (p->env->stats, | ||
1212 | stat_txt, bytes_read, GNUNET_NO); | ||
1213 | GNUNET_free (stat_txt); | ||
1214 | } | ||
1198 | return bytes_read; | 1215 | return bytes_read; |
1199 | } | 1216 | } |
1200 | 1217 | ||
@@ -1214,6 +1231,7 @@ server_receive_mst_cb (void *cls, void *client, | |||
1214 | struct Session *s = cls; | 1231 | struct Session *s = cls; |
1215 | struct GNUNET_ATS_Information atsi[2]; | 1232 | struct GNUNET_ATS_Information atsi[2]; |
1216 | struct GNUNET_TIME_Relative delay; | 1233 | struct GNUNET_TIME_Relative delay; |
1234 | char *stat_txt; | ||
1217 | 1235 | ||
1218 | GNUNET_assert (NULL != p); | 1236 | GNUNET_assert (NULL != p); |
1219 | if (GNUNET_NO == server_exist_session(p, s)) | 1237 | if (GNUNET_NO == server_exist_session(p, s)) |
@@ -1227,11 +1245,18 @@ server_receive_mst_cb (void *cls, void *client, | |||
1227 | atsi[1].value = s->ats_address_network_type; | 1245 | atsi[1].value = s->ats_address_network_type; |
1228 | GNUNET_break (s->ats_address_network_type != ntohl (GNUNET_ATS_NET_UNSPECIFIED)); | 1246 | GNUNET_break (s->ats_address_network_type != ntohl (GNUNET_ATS_NET_UNSPECIFIED)); |
1229 | 1247 | ||
1248 | |||
1230 | delay = plugin->env->receive (plugin->env->cls, | 1249 | delay = plugin->env->receive (plugin->env->cls, |
1231 | &s->target, | 1250 | &s->target, |
1232 | message, | 1251 | message, |
1233 | (const struct GNUNET_ATS_Information *) &atsi, 2, | 1252 | (const struct GNUNET_ATS_Information *) &atsi, 2, |
1234 | s, s->addr, s->addrlen); | 1253 | s, s->addr, s->addrlen); |
1254 | |||
1255 | GNUNET_asprintf (&stat_txt, "# bytes received via %s_server", plugin->protocol); | ||
1256 | GNUNET_STATISTICS_update (plugin->env->stats, | ||
1257 | stat_txt, ntohs (message->size), GNUNET_NO); | ||
1258 | GNUNET_free (stat_txt); | ||
1259 | |||
1235 | s->session_passed = GNUNET_YES; | 1260 | s->session_passed = GNUNET_YES; |
1236 | s->next_receive = GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get (), delay); | 1261 | s->next_receive = GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get (), delay); |
1237 | if (delay.rel_value > 0) | 1262 | if (delay.rel_value > 0) |