aboutsummaryrefslogtreecommitdiff
path: root/src/datastore
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-10-23 13:34:01 +0000
committerChristian Grothoff <christian@grothoff.org>2012-10-23 13:34:01 +0000
commit6e035f5efca76d374b1ad93a245f050a85d0e496 (patch)
tree874b49e5454f4b1a0274f87188f6d5a90b15c059 /src/datastore
parentb6a532c9f1ae572e4c14a5d88dcb8251f0af7ef6 (diff)
downloadgnunet-6e035f5efca76d374b1ad93a245f050a85d0e496.tar.gz
gnunet-6e035f5efca76d374b1ad93a245f050a85d0e496.zip
-reduce statistics (#2594)
Diffstat (limited to 'src/datastore')
-rw-r--r--src/datastore/datastore_api.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/datastore/datastore_api.c b/src/datastore/datastore_api.c
index 3bf8ecd94..fcfc076d2 100644
--- a/src/datastore/datastore_api.c
+++ b/src/datastore/datastore_api.c
@@ -34,6 +34,11 @@
34#define LOG(kind,...) GNUNET_log_from (kind, "datastore-api",__VA_ARGS__) 34#define LOG(kind,...) GNUNET_log_from (kind, "datastore-api",__VA_ARGS__)
35 35
36/** 36/**
37 * Collect an instane number of statistics? May cause excessive IPC.
38 */
39#define INSANE_STATISTICS GNUNET_NO
40
41/**
37 * If a client stopped asking for more results, how many more do 42 * If a client stopped asking for more results, how many more do
38 * we receive from the DB before killing the connection? Trade-off 43 * we receive from the DB before killing the connection? Trade-off
39 * between re-doing TCP handshakes and (needlessly) receiving 44 * between re-doing TCP handshakes and (needlessly) receiving
@@ -456,13 +461,14 @@ make_queue_entry (struct GNUNET_DATASTORE_Handle *h, size_t msize,
456 pos = h->queue_head; 461 pos = h->queue_head;
457 } 462 }
458 c++; 463 c++;
464#if INSANE_STATISTICS
459 GNUNET_STATISTICS_update (h->stats, gettext_noop ("# queue entries created"), 465 GNUNET_STATISTICS_update (h->stats, gettext_noop ("# queue entries created"),
460 1, GNUNET_NO); 466 1, GNUNET_NO);
467#endif
461 GNUNET_CONTAINER_DLL_insert_after (h->queue_head, h->queue_tail, pos, ret); 468 GNUNET_CONTAINER_DLL_insert_after (h->queue_head, h->queue_tail, pos, ret);
462 h->queue_size++; 469 h->queue_size++;
463 ret->task = GNUNET_SCHEDULER_add_delayed (timeout, &timeout_queue_entry, ret); 470 ret->task = GNUNET_SCHEDULER_add_delayed (timeout, &timeout_queue_entry, ret);
464 pos = ret->next; 471 for (pos = ret->next; NULL != pos; pos = pos->next)
465 while (pos != NULL)
466 { 472 {
467 if ((pos->max_queue < h->queue_size) && (pos->was_transmitted == GNUNET_NO)) 473 if ((pos->max_queue < h->queue_size) && (pos->was_transmitted == GNUNET_NO))
468 { 474 {
@@ -480,7 +486,6 @@ make_queue_entry (struct GNUNET_DATASTORE_Handle *h, size_t msize,
480 pos->response_proc (h, NULL); 486 pos->response_proc (h, NULL);
481 break; 487 break;
482 } 488 }
483 pos = pos->next;
484 } 489 }
485 return ret; 490 return ret;
486} 491}
@@ -544,10 +549,6 @@ do_disconnect (struct GNUNET_DATASTORE_Handle *h)
544 "client NULL in disconnect, will not try to reconnect\n"); 549 "client NULL in disconnect, will not try to reconnect\n");
545 return; 550 return;
546 } 551 }
547#if 0
548 GNUNET_STATISTICS_update (stats, gettext_noop ("# reconnected to DATASTORE"),
549 1, GNUNET_NO);
550#endif
551 GNUNET_CLIENT_disconnect (h->client); 552 GNUNET_CLIENT_disconnect (h->client);
552 h->skip_next_messages = 0; 553 h->skip_next_messages = 0;
553 h->client = NULL; 554 h->client = NULL;
@@ -629,9 +630,11 @@ transmit_request (void *cls, size_t size, void *buf)
629 h->in_receive = GNUNET_YES; 630 h->in_receive = GNUNET_YES;
630 GNUNET_CLIENT_receive (h->client, &receive_cb, h, 631 GNUNET_CLIENT_receive (h->client, &receive_cb, h,
631 GNUNET_TIME_absolute_get_remaining (qe->timeout)); 632 GNUNET_TIME_absolute_get_remaining (qe->timeout));
633#if INSANE_STATISTICS
632 GNUNET_STATISTICS_update (h->stats, 634 GNUNET_STATISTICS_update (h->stats,
633 gettext_noop ("# bytes sent to datastore"), 1, 635 gettext_noop ("# bytes sent to datastore"), 1,
634 GNUNET_NO); 636 GNUNET_NO);
637#endif
635 return msize; 638 return msize;
636} 639}
637 640
@@ -1218,8 +1221,10 @@ process_result_message (void *cls, const struct GNUNET_MessageHeader *msg)
1218 0); 1221 0);
1219 return; 1222 return;
1220 } 1223 }
1224#if INSANE_STATISTICS
1221 GNUNET_STATISTICS_update (h->stats, gettext_noop ("# Results received"), 1, 1225 GNUNET_STATISTICS_update (h->stats, gettext_noop ("# Results received"), 1,
1222 GNUNET_NO); 1226 GNUNET_NO);
1227#endif
1223 dm = (const struct DataMessage *) msg; 1228 dm = (const struct DataMessage *) msg;
1224 LOG (GNUNET_ERROR_TYPE_DEBUG, 1229 LOG (GNUNET_ERROR_TYPE_DEBUG,
1225 "Received result %llu with type %u and size %u with key %s\n", 1230 "Received result %llu with type %u and size %u with key %s\n",
@@ -1406,8 +1411,10 @@ GNUNET_DATASTORE_get_key (struct GNUNET_DATASTORE_Handle *h, uint64_t offset,
1406 GNUNET_h2s (key)); 1411 GNUNET_h2s (key));
1407 return NULL; 1412 return NULL;
1408 } 1413 }
1414#if INSANE_STATISTICS
1409 GNUNET_STATISTICS_update (h->stats, gettext_noop ("# GET requests executed"), 1415 GNUNET_STATISTICS_update (h->stats, gettext_noop ("# GET requests executed"),
1410 1, GNUNET_NO); 1416 1, GNUNET_NO);
1417#endif
1411 gm = (struct GetMessage *) &qe[1]; 1418 gm = (struct GetMessage *) &qe[1];
1412 gm->header.type = htons (GNUNET_MESSAGE_TYPE_DATASTORE_GET); 1419 gm->header.type = htons (GNUNET_MESSAGE_TYPE_DATASTORE_GET);
1413 gm->type = htonl (type); 1420 gm->type = htonl (type);