diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2012-05-11 08:18:01 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2012-05-11 08:18:01 +0000 |
commit | 2c12d7cc5ffcd5fe9a4fb651e75fe38cd10d7121 (patch) | |
tree | 0239676b53b413548da1273450ef2c41979efb87 /src | |
parent | b1ab6811dd4518fd54bd99678c3563e92373d1e5 (diff) | |
download | gnunet-2c12d7cc5ffcd5fe9a4fb651e75fe38cd10d7121.tar.gz gnunet-2c12d7cc5ffcd5fe9a4fb651e75fe38cd10d7121.zip |
- fixing stat values
Diffstat (limited to 'src')
-rw-r--r-- | src/transport/gnunet-service-transport.c | 14 | ||||
-rw-r--r-- | src/transport/gnunet-service-transport_clients.c | 5 | ||||
-rw-r--r-- | src/transport/gnunet-service-transport_neighbours.c | 22 |
3 files changed, 33 insertions, 8 deletions
diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c index 679d52937..981cd33fa 100644 --- a/src/transport/gnunet-service-transport.c +++ b/src/transport/gnunet-service-transport.c | |||
@@ -221,6 +221,8 @@ plugin_env_receive_callback (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
221 | struct GNUNET_TIME_Relative ret; | 221 | struct GNUNET_TIME_Relative ret; |
222 | struct GNUNET_HELLO_Address address; | 222 | struct GNUNET_HELLO_Address address; |
223 | uint16_t type; | 223 | uint16_t type; |
224 | static unsigned int bytes_total_received; | ||
225 | static unsigned int bytes_payload_received; | ||
224 | 226 | ||
225 | address.peer = *peer; | 227 | address.peer = *peer; |
226 | address.address = sender_address; | 228 | address.address = sender_address; |
@@ -231,6 +233,13 @@ plugin_env_receive_callback (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
231 | goto end; | 233 | goto end; |
232 | type = ntohs (message->type); | 234 | type = ntohs (message->type); |
233 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received Message with type %u\n", type); | 235 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received Message with type %u\n", type); |
236 | |||
237 | bytes_total_received += ntohs (message->size); | ||
238 | GNUNET_STATISTICS_set (GST_stats, | ||
239 | gettext_noop | ||
240 | ("# bytes total received"), | ||
241 | bytes_total_received, GNUNET_NO); | ||
242 | |||
234 | switch (type) | 243 | switch (type) |
235 | { | 244 | { |
236 | case GNUNET_MESSAGE_TYPE_HELLO: | 245 | case GNUNET_MESSAGE_TYPE_HELLO: |
@@ -273,6 +282,11 @@ plugin_env_receive_callback (void *cls, const struct GNUNET_PeerIdentity *peer, | |||
273 | break; | 282 | break; |
274 | default: | 283 | default: |
275 | /* should be payload */ | 284 | /* should be payload */ |
285 | bytes_payload_received += ntohs (message->size); | ||
286 | GNUNET_STATISTICS_set (GST_stats, | ||
287 | gettext_noop | ||
288 | ("# bytes payload received"), | ||
289 | bytes_payload_received, GNUNET_NO); | ||
276 | ret = process_payload (peer, &address, session, message, ats, ats_count); | 290 | ret = process_payload (peer, &address, session, message, ats, ats_count); |
277 | break; | 291 | break; |
278 | } | 292 | } |
diff --git a/src/transport/gnunet-service-transport_clients.c b/src/transport/gnunet-service-transport_clients.c index 98844f830..b2981951d 100644 --- a/src/transport/gnunet-service-transport_clients.c +++ b/src/transport/gnunet-service-transport_clients.c | |||
@@ -616,10 +616,7 @@ clients_handle_send (void *cls, struct GNUNET_SERVER_Client *client, | |||
616 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); | 616 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); |
617 | return; | 617 | return; |
618 | } | 618 | } |
619 | GNUNET_STATISTICS_update (GST_stats, | 619 | |
620 | gettext_noop | ||
621 | ("# bytes payload received for other peers"), msize, | ||
622 | GNUNET_NO); | ||
623 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 620 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
624 | "Received `%s' request from client with target `%4s' and first message of type %u and total size %u\n", | 621 | "Received `%s' request from client with target `%4s' and first message of type %u and total size %u\n", |
625 | "SEND", GNUNET_i2s (&obm->peer), ntohs (obmm->type), msize); | 622 | "SEND", GNUNET_i2s (&obm->peer), ntohs (obmm->type), msize); |
diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c index 07c48caba..bdb67dbca 100644 --- a/src/transport/gnunet-service-transport_neighbours.c +++ b/src/transport/gnunet-service-transport_neighbours.c | |||
@@ -401,6 +401,9 @@ static GNUNET_TRANSPORT_PeerIterateCallback address_change_cb; | |||
401 | */ | 401 | */ |
402 | static int neighbours_connected; | 402 | static int neighbours_connected; |
403 | 403 | ||
404 | static unsigned int bytes_in_send_queue; | ||
405 | static unsigned int bytes_received; | ||
406 | |||
404 | /** | 407 | /** |
405 | * Lookup a neighbour entry in the neighbours hash map. | 408 | * Lookup a neighbour entry in the neighbours hash map. |
406 | * | 409 | * |
@@ -710,6 +713,14 @@ transmit_send_continuation (void *cls, | |||
710 | n->transmission_task = GNUNET_SCHEDULER_add_now (&transmission_task, n); | 713 | n->transmission_task = GNUNET_SCHEDULER_add_now (&transmission_task, n); |
711 | } | 714 | } |
712 | } | 715 | } |
716 | |||
717 | GNUNET_assert (bytes_in_send_queue >= mq->message_buf_size); | ||
718 | bytes_in_send_queue -= mq->message_buf_size; | ||
719 | GNUNET_STATISTICS_set (GST_stats, | ||
720 | gettext_noop | ||
721 | ("# bytes in message queue for other peers"), | ||
722 | bytes_in_send_queue, GNUNET_NO); | ||
723 | |||
713 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending message of type %u was %s\n", | 724 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending message of type %u was %s\n", |
714 | ntohs (((struct GNUNET_MessageHeader *) mq->message_buf)->type), | 725 | ntohs (((struct GNUNET_MessageHeader *) mq->message_buf)->type), |
715 | (success == GNUNET_OK) ? "successful" : "FAILED"); | 726 | (success == GNUNET_OK) ? "successful" : "FAILED"); |
@@ -838,6 +849,8 @@ GST_neighbours_start (void *cls, | |||
838 | address_change_cb = peer_address_cb; | 849 | address_change_cb = peer_address_cb; |
839 | neighbours = GNUNET_CONTAINER_multihashmap_create (NEIGHBOUR_TABLE_SIZE); | 850 | neighbours = GNUNET_CONTAINER_multihashmap_create (NEIGHBOUR_TABLE_SIZE); |
840 | neighbours_connected = 0; | 851 | neighbours_connected = 0; |
852 | bytes_in_send_queue = 0; | ||
853 | bytes_received = 0; | ||
841 | } | 854 | } |
842 | 855 | ||
843 | 856 | ||
@@ -1977,10 +1990,11 @@ GST_neighbours_send (const struct GNUNET_PeerIdentity *target, const void *msg, | |||
1977 | } | 1990 | } |
1978 | 1991 | ||
1979 | GNUNET_assert (msg_size >= sizeof (struct GNUNET_MessageHeader)); | 1992 | GNUNET_assert (msg_size >= sizeof (struct GNUNET_MessageHeader)); |
1980 | GNUNET_STATISTICS_update (GST_stats, | 1993 | bytes_in_send_queue += msg_size; |
1981 | gettext_noop | 1994 | GNUNET_STATISTICS_set (GST_stats, |
1982 | ("# bytes in message queue for other peers"), | 1995 | gettext_noop |
1983 | msg_size, GNUNET_NO); | 1996 | ("# bytes in message queue for other peers"), |
1997 | bytes_in_send_queue, GNUNET_NO); | ||
1984 | mq = GNUNET_malloc (sizeof (struct MessageQueue) + msg_size); | 1998 | mq = GNUNET_malloc (sizeof (struct MessageQueue) + msg_size); |
1985 | mq->cont = cont; | 1999 | mq->cont = cont; |
1986 | mq->cont_cls = cont_cls; | 2000 | mq->cont_cls = cont_cls; |