aboutsummaryrefslogtreecommitdiff
path: root/src/core/gnunet-service-core.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-03-17 13:26:31 +0000
committerChristian Grothoff <christian@grothoff.org>2010-03-17 13:26:31 +0000
commit1398dcf9619f368e96cec587006a57f8c096b7a9 (patch)
treef688828e8733200761bc84fe8d8fbcfa8a382f25 /src/core/gnunet-service-core.c
parentefd752b548208bc8b23753a1383291241419d4ec (diff)
downloadgnunet-1398dcf9619f368e96cec587006a57f8c096b7a9.tar.gz
gnunet-1398dcf9619f368e96cec587006a57f8c096b7a9.zip
more stats
Diffstat (limited to 'src/core/gnunet-service-core.c')
-rw-r--r--src/core/gnunet-service-core.c38
1 files 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)
1299 prev->next = n->next; 1299 prev->next = n->next;
1300 GNUNET_assert (neighbour_count > 0); 1300 GNUNET_assert (neighbour_count > 0);
1301 neighbour_count--; 1301 neighbour_count--;
1302 GNUNET_STATISTICS_set (stats, gettext_noop ("# active neighbours"), neighbour_count, GNUNET_NO); 1302 GNUNET_STATISTICS_set (stats,
1303 gettext_noop ("# active neighbours"),
1304 neighbour_count,
1305 GNUNET_NO);
1303 free_neighbour (n); 1306 free_neighbour (n);
1304} 1307}
1305 1308
@@ -3051,6 +3054,7 @@ static void
3051deliver_message (struct Neighbour *sender, 3054deliver_message (struct Neighbour *sender,
3052 const struct GNUNET_MessageHeader *m, size_t msize) 3055 const struct GNUNET_MessageHeader *m, size_t msize)
3053{ 3056{
3057 char buf[256];
3054 struct Client *cpos; 3058 struct Client *cpos;
3055 uint16_t type; 3059 uint16_t type;
3056 unsigned int tpos; 3060 unsigned int tpos;
@@ -3064,6 +3068,14 @@ deliver_message (struct Neighbour *sender,
3064 type, 3068 type,
3065 GNUNET_i2s (&sender->peer)); 3069 GNUNET_i2s (&sender->peer));
3066#endif 3070#endif
3071 GNUNET_snprintf (buf,
3072 sizeof(buf),
3073 gettext_noop ("# bytes of messages of type %u received"),
3074 type);
3075 GNUNET_STATISTICS_set (stats,
3076 buf,
3077 msize,
3078 GNUNET_NO);
3067 dropped = GNUNET_YES; 3079 dropped = GNUNET_YES;
3068 cpos = clients; 3080 cpos = clients;
3069 while (cpos != NULL) 3081 while (cpos != NULL)
@@ -3190,7 +3202,6 @@ handle_encrypted_message (struct Neighbour *n,
3190 char buf[size]; 3202 char buf[size];
3191 struct EncryptedMessage *pt; /* plaintext */ 3203 struct EncryptedMessage *pt; /* plaintext */
3192 GNUNET_HashCode ph; 3204 GNUNET_HashCode ph;
3193 size_t off;
3194 uint32_t snum; 3205 uint32_t snum;
3195 struct GNUNET_TIME_Absolute t; 3206 struct GNUNET_TIME_Absolute t;
3196 GNUNET_HashCode iv; 3207 GNUNET_HashCode iv;
@@ -3230,6 +3241,10 @@ handle_encrypted_message (struct Neighbour *n,
3230 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 3241 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
3231 "Received duplicate message, ignoring.\n"); 3242 "Received duplicate message, ignoring.\n");
3232 /* duplicate, ignore */ 3243 /* duplicate, ignore */
3244 GNUNET_STATISTICS_set (stats,
3245 gettext_noop ("# bytes dropped (duplicates)"),
3246 size,
3247 GNUNET_NO);
3233 return; 3248 return;
3234 } 3249 }
3235 if ((n->last_sequence_number_received > snum) && 3250 if ((n->last_sequence_number_received > snum) &&
@@ -3238,6 +3253,10 @@ handle_encrypted_message (struct Neighbour *n,
3238 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 3253 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
3239 "Received ancient out of sequence message, ignoring.\n"); 3254 "Received ancient out of sequence message, ignoring.\n");
3240 /* ancient out of sequence, ignore */ 3255 /* ancient out of sequence, ignore */
3256 GNUNET_STATISTICS_set (stats,
3257 gettext_noop ("# bytes dropped (out of sequence)"),
3258 size,
3259 GNUNET_NO);
3241 return; 3260 return;
3242 } 3261 }
3243 if (n->last_sequence_number_received > snum) 3262 if (n->last_sequence_number_received > snum)
@@ -3248,6 +3267,10 @@ handle_encrypted_message (struct Neighbour *n,
3248 { 3267 {
3249 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 3268 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
3250 "Received duplicate message, ignoring.\n"); 3269 "Received duplicate message, ignoring.\n");
3270 GNUNET_STATISTICS_set (stats,
3271 gettext_noop ("# bytes dropped (duplicates)"),
3272 size,
3273 GNUNET_NO);
3251 /* duplicate, ignore */ 3274 /* duplicate, ignore */
3252 return; 3275 return;
3253 } 3276 }
@@ -3267,6 +3290,10 @@ handle_encrypted_message (struct Neighbour *n,
3267 _ 3290 _
3268 ("Message received far too old (%llu ms). Content ignored.\n"), 3291 ("Message received far too old (%llu ms). Content ignored.\n"),
3269 GNUNET_TIME_absolute_get_duration (t).value); 3292 GNUNET_TIME_absolute_get_duration (t).value);
3293 GNUNET_STATISTICS_set (stats,
3294 gettext_noop ("# bytes dropped (ancient message)"),
3295 size,
3296 GNUNET_NO);
3270 return; 3297 return;
3271 } 3298 }
3272 3299
@@ -3299,8 +3326,11 @@ handle_encrypted_message (struct Neighbour *n,
3299 GNUNET_TIME_relative_divide (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT, 2), 3326 GNUNET_TIME_relative_divide (GNUNET_CONSTANTS_IDLE_CONNECTION_TIMEOUT, 2),
3300 &send_keep_alive, 3327 &send_keep_alive,
3301 n); 3328 n);
3302 off = sizeof (struct EncryptedMessage); 3329 GNUNET_STATISTICS_set (stats,
3303 deliver_messages (n, buf, size, off); 3330 gettext_noop ("# bytes of payload decrypted"),
3331 size - sizeof (struct EncryptedMessage),
3332 GNUNET_NO);
3333 deliver_messages (n, buf, size, sizeof (struct EncryptedMessage));
3304} 3334}
3305 3335
3306 3336