From 1398dcf9619f368e96cec587006a57f8c096b7a9 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 17 Mar 2010 13:26:31 +0000 Subject: [PATCH] more stats --- src/core/gnunet-service-core.c | 38 ++++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/src/core/gnunet-service-core.c b/src/core/gnunet-service-core.c index 6db1a7142..5a4a78298 100644 --- a/src/core/gnunet-service-core.c +++ b/src/core/gnunet-service-core.c @@ -1299,7 +1299,10 @@ consider_free_neighbour (struct Neighbour *n) prev->next = n->next; GNUNET_assert (neighbour_count > 0); neighbour_count--; - GNUNET_STATISTICS_set (stats, gettext_noop ("# active neighbours"), neighbour_count, GNUNET_NO); + GNUNET_STATISTICS_set (stats, + gettext_noop ("# active neighbours"), + neighbour_count, + GNUNET_NO); free_neighbour (n); } @@ -3051,6 +3054,7 @@ static void deliver_message (struct Neighbour *sender, const struct GNUNET_MessageHeader *m, size_t msize) { + char buf[256]; struct Client *cpos; uint16_t type; unsigned int tpos; @@ -3064,6 +3068,14 @@ deliver_message (struct Neighbour *sender, type, GNUNET_i2s (&sender->peer)); #endif + GNUNET_snprintf (buf, + sizeof(buf), + gettext_noop ("# bytes of messages of type %u received"), + type); + GNUNET_STATISTICS_set (stats, + buf, + msize, + GNUNET_NO); dropped = GNUNET_YES; cpos = clients; while (cpos != NULL) @@ -3190,7 +3202,6 @@ handle_encrypted_message (struct Neighbour *n, char buf[size]; struct EncryptedMessage *pt; /* plaintext */ GNUNET_HashCode ph; - size_t off; uint32_t snum; struct GNUNET_TIME_Absolute t; GNUNET_HashCode iv; @@ -3230,6 +3241,10 @@ handle_encrypted_message (struct Neighbour *n, GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Received duplicate message, ignoring.\n"); /* duplicate, ignore */ + GNUNET_STATISTICS_set (stats, + gettext_noop ("# bytes dropped (duplicates)"), + size, + GNUNET_NO); return; } if ((n->last_sequence_number_received > snum) && @@ -3238,6 +3253,10 @@ handle_encrypted_message (struct Neighbour *n, GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Received ancient out of sequence message, ignoring.\n"); /* ancient out of sequence, ignore */ + GNUNET_STATISTICS_set (stats, + gettext_noop ("# bytes dropped (out of sequence)"), + size, + GNUNET_NO); return; } if (n->last_sequence_number_received > snum) @@ -3248,6 +3267,10 @@ handle_encrypted_message (struct Neighbour *n, { GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Received duplicate message, ignoring.\n"); + GNUNET_STATISTICS_set (stats, + gettext_noop ("# bytes dropped (duplicates)"), + size, + GNUNET_NO); /* duplicate, ignore */ return; } @@ -3267,6 +3290,10 @@ handle_encrypted_message (struct Neighbour *n, _ ("Message received far too old (%llu ms). Content ignored.\n"), GNUNET_TIME_absolute_get_duration (t).value); + GNUNET_STATISTICS_set (stats, + gettext_noop ("# bytes dropped (ancient message)"), + size, + GNUNET_NO); return; } @@ -3299,8 +3326,11 @@ handle_encrypted_message (struct Neighbour *n, GNUNET_TIME_relative_divide (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT, 2), &send_keep_alive, n); - off = sizeof (struct EncryptedMessage); - deliver_messages (n, buf, size, off); + GNUNET_STATISTICS_set (stats, + gettext_noop ("# bytes of payload decrypted"), + size - sizeof (struct EncryptedMessage), + GNUNET_NO); + deliver_messages (n, buf, size, sizeof (struct EncryptedMessage)); } -- 2.25.1