diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-05-30 15:33:19 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-05-30 15:33:19 +0000 |
commit | 93002ad128d9dc23f80fc2384e0dd3f033315c14 (patch) | |
tree | 3c164635a06ae666d39acd155d7d947465f95b74 /src/fs/gnunet-service-fs_pe.c | |
parent | 8dc367b10a197123c7148505aa1757055c2e3502 (diff) | |
download | gnunet-93002ad128d9dc23f80fc2384e0dd3f033315c14.tar.gz gnunet-93002ad128d9dc23f80fc2384e0dd3f033315c14.zip |
track performance data
Diffstat (limited to 'src/fs/gnunet-service-fs_pe.c')
-rw-r--r-- | src/fs/gnunet-service-fs_pe.c | 46 |
1 files changed, 41 insertions, 5 deletions
diff --git a/src/fs/gnunet-service-fs_pe.c b/src/fs/gnunet-service-fs_pe.c index 2ae50259d..6c4d3df17 100644 --- a/src/fs/gnunet-service-fs_pe.c +++ b/src/fs/gnunet-service-fs_pe.c | |||
@@ -119,6 +119,16 @@ struct PeerPlan | |||
119 | */ | 119 | */ |
120 | static struct GNUNET_CONTAINER_MultiHashMap *plans; | 120 | static struct GNUNET_CONTAINER_MultiHashMap *plans; |
121 | 121 | ||
122 | /** | ||
123 | * Sum of all transmission counters (equals total delay for all plan entries). | ||
124 | */ | ||
125 | static unsigned long long total_delay; | ||
126 | |||
127 | /** | ||
128 | * Number of plan entries. | ||
129 | */ | ||
130 | static unsigned long long plan_count; | ||
131 | |||
122 | 132 | ||
123 | /** | 133 | /** |
124 | * Figure out when and how to transmit to the given peer. | 134 | * Figure out when and how to transmit to the given peer. |
@@ -142,15 +152,19 @@ plan (struct PeerPlan *pp, | |||
142 | struct GSF_RequestPlan *rp) | 152 | struct GSF_RequestPlan *rp) |
143 | { | 153 | { |
144 | struct GSF_PendingRequestData *prd; | 154 | struct GSF_PendingRequestData *prd; |
155 | struct GNUNET_TIME_Relative delay; | ||
145 | 156 | ||
157 | GNUNET_STATISTICS_set (GSF_stats, | ||
158 | gettext_noop ("# average retransmission delay (ms)"), | ||
159 | total_delay * 1000LL / plan_count, | ||
160 | GNUNET_NO); | ||
146 | prd = GSF_pending_request_get_data_ (rp->pr); | 161 | prd = GSF_pending_request_get_data_ (rp->pr); |
147 | // FIXME: calculate 'rp->earliest_transmission'! | 162 | // FIXME: calculate 'rp->earliest_transmission'! |
148 | // FIXME: claculate 'rp->priority'! | 163 | // FIXME: claculate 'rp->priority'! |
164 | delay = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, | ||
165 | rp->transmission_counter); | ||
149 | rp->earliest_transmission | 166 | rp->earliest_transmission |
150 | = GNUNET_TIME_relative_to_absolute | 167 | = GNUNET_TIME_relative_to_absolute (delay); |
151 | (GNUNET_TIME_relative_multiply | ||
152 | (GNUNET_TIME_UNIT_SECONDS, | ||
153 | rp->transmission_counter)); | ||
154 | #if DEBUG_FS | 168 | #if DEBUG_FS |
155 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 169 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
156 | "Earliest (re)transmission for `%s' in %us\n", | 170 | "Earliest (re)transmission for `%s' in %us\n", |
@@ -215,6 +229,7 @@ transmit_message_callback (void *cls, | |||
215 | rp->hn = NULL; | 229 | rp->hn = NULL; |
216 | rp->last_transmission = GNUNET_TIME_absolute_get (); | 230 | rp->last_transmission = GNUNET_TIME_absolute_get (); |
217 | rp->transmission_counter++; | 231 | rp->transmission_counter++; |
232 | total_delay++; | ||
218 | #if DEBUG_FS | 233 | #if DEBUG_FS |
219 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 234 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
220 | "Executing plan %p executed %u times, planning retransmission\n", | 235 | "Executing plan %p executed %u times, planning retransmission\n", |
@@ -222,6 +237,10 @@ transmit_message_callback (void *cls, | |||
222 | rp->transmission_counter); | 237 | rp->transmission_counter); |
223 | #endif | 238 | #endif |
224 | plan (pp, rp); | 239 | plan (pp, rp); |
240 | GNUNET_STATISTICS_update (GSF_stats, | ||
241 | gettext_noop ("# queries messages sent to other peers"), | ||
242 | 1, | ||
243 | GNUNET_NO); | ||
225 | return msize; | 244 | return msize; |
226 | } | 245 | } |
227 | 246 | ||
@@ -330,6 +349,11 @@ GSF_plan_add_ (struct GSF_ConnectedPeer *cp, | |||
330 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); | 349 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); |
331 | } | 350 | } |
332 | prd = GSF_pending_request_get_data_ (pr); | 351 | prd = GSF_pending_request_get_data_ (pr); |
352 | plan_count++; | ||
353 | GNUNET_STATISTICS_update (GSF_stats, | ||
354 | gettext_noop ("# query plan entries"), | ||
355 | 1, | ||
356 | GNUNET_NO); | ||
333 | rp = GNUNET_malloc (sizeof (struct GSF_RequestPlan)); | 357 | rp = GNUNET_malloc (sizeof (struct GSF_RequestPlan)); |
334 | #if DEBUG_FS | 358 | #if DEBUG_FS |
335 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 359 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -381,6 +405,7 @@ GSF_plan_notify_peer_disconnect_ (const struct GSF_ConnectedPeer *cp) | |||
381 | GNUNET_CONTAINER_DLL_remove (prd->rp_head, | 405 | GNUNET_CONTAINER_DLL_remove (prd->rp_head, |
382 | prd->rp_tail, | 406 | prd->rp_tail, |
383 | rp); | 407 | rp); |
408 | plan_count--; | ||
384 | GNUNET_free (rp); | 409 | GNUNET_free (rp); |
385 | } | 410 | } |
386 | GNUNET_CONTAINER_heap_destroy (pp->priority_heap); | 411 | GNUNET_CONTAINER_heap_destroy (pp->priority_heap); |
@@ -390,8 +415,14 @@ GSF_plan_notify_peer_disconnect_ (const struct GSF_ConnectedPeer *cp) | |||
390 | GNUNET_CONTAINER_DLL_remove (prd->rp_head, | 415 | GNUNET_CONTAINER_DLL_remove (prd->rp_head, |
391 | prd->rp_tail, | 416 | prd->rp_tail, |
392 | rp); | 417 | rp); |
418 | plan_count--; | ||
393 | GNUNET_free (rp); | 419 | GNUNET_free (rp); |
394 | } | 420 | } |
421 | GNUNET_STATISTICS_set (GSF_stats, | ||
422 | gettext_noop ("# query plan entries"), | ||
423 | plan_count, | ||
424 | GNUNET_NO); | ||
425 | |||
395 | GNUNET_CONTAINER_heap_destroy (pp->delay_heap); | 426 | GNUNET_CONTAINER_heap_destroy (pp->delay_heap); |
396 | GNUNET_free (pp); | 427 | GNUNET_free (pp); |
397 | } | 428 | } |
@@ -416,8 +447,13 @@ GSF_plan_notify_request_done_ (struct GSF_PendingRequest *pr) | |||
416 | GNUNET_CONTAINER_DLL_remove (prd->rp_head, | 447 | GNUNET_CONTAINER_DLL_remove (prd->rp_head, |
417 | prd->rp_tail, | 448 | prd->rp_tail, |
418 | rp); | 449 | rp); |
450 | plan_count--; | ||
419 | GNUNET_free (rp); | 451 | GNUNET_free (rp); |
420 | } | 452 | } |
453 | GNUNET_STATISTICS_set (GSF_stats, | ||
454 | gettext_noop ("# query plan entries"), | ||
455 | plan_count, | ||
456 | GNUNET_NO); | ||
421 | } | 457 | } |
422 | 458 | ||
423 | 459 | ||