aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2015-10-07 18:05:23 +0000
committerFlorian Dold <florian.dold@gmail.com>2015-10-07 18:05:23 +0000
commitca2a0be297732b8cd8b2f6635bc6be6d6a717860 (patch)
tree7531fcff29073f9edb2ae485221db7b6e0a43fb8
parentdee73e0b5c185a16f2894ccdb3ddb20b0569c0a2 (diff)
downloadgnunet-ca2a0be297732b8cd8b2f6635bc6be6d6a717860.tar.gz
gnunet-ca2a0be297732b8cd8b2f6635bc6be6d6a717860.zip
set statistics
-rw-r--r--src/set/Makefile.am1
-rw-r--r--src/set/gnunet-service-set.c8
-rw-r--r--src/set/gnunet-service-set.h3
-rw-r--r--src/set/gnunet-service-set_union.c28
4 files changed, 40 insertions, 0 deletions
diff --git a/src/set/Makefile.am b/src/set/Makefile.am
index 5f7888221..5da0c564a 100644
--- a/src/set/Makefile.am
+++ b/src/set/Makefile.am
@@ -50,6 +50,7 @@ gnunet_service_set_SOURCES = \
50 gnunet-service-set_protocol.h 50 gnunet-service-set_protocol.h
51gnunet_service_set_LDADD = \ 51gnunet_service_set_LDADD = \
52 $(top_builddir)/src/util/libgnunetutil.la \ 52 $(top_builddir)/src/util/libgnunetutil.la \
53 $(top_builddir)/src/statistics/libgnunetstatistics.la \
53 $(top_builddir)/src/core/libgnunetcore.la \ 54 $(top_builddir)/src/core/libgnunetcore.la \
54 $(top_builddir)/src/cadet/libgnunetcadet.la \ 55 $(top_builddir)/src/cadet/libgnunetcadet.la \
55 $(top_builddir)/src/block/libgnunetblock.la \ 56 $(top_builddir)/src/block/libgnunetblock.la \
diff --git a/src/set/gnunet-service-set.c b/src/set/gnunet-service-set.c
index 0557bc1f2..cc172974e 100644
--- a/src/set/gnunet-service-set.c
+++ b/src/set/gnunet-service-set.c
@@ -25,6 +25,7 @@
25 */ 25 */
26#include "gnunet-service-set.h" 26#include "gnunet-service-set.h"
27#include "gnunet-service-set_protocol.h" 27#include "gnunet-service-set_protocol.h"
28#include "gnunet_statistics_service.h"
28 29
29/** 30/**
30 * How long do we hold on to an incoming channel if there is 31 * How long do we hold on to an incoming channel if there is
@@ -137,6 +138,11 @@ static uint32_t lazy_copy_cookie = 1;
137 */ 138 */
138static uint32_t suggest_id = 1; 139static uint32_t suggest_id = 1;
139 140
141/**
142 * Statistics handle.
143 */
144struct GNUNET_STATISTICS_Handle *_GSS_statistics;
145
140 146
141/** 147/**
142 * Get set that is owned by the given client, if any. 148 * Get set that is owned by the given client, if any.
@@ -1716,6 +1722,7 @@ shutdown_task (void *cls,
1716 GNUNET_CADET_disconnect (cadet); 1722 GNUNET_CADET_disconnect (cadet);
1717 cadet = NULL; 1723 cadet = NULL;
1718 } 1724 }
1725 GNUNET_STATISTICS_destroy (_GSS_statistics, GNUNET_YES);
1719 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1726 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1720 "handled shutdown request\n"); 1727 "handled shutdown request\n");
1721} 1728}
@@ -1987,6 +1994,7 @@ run (void *cls,
1987 &handle_client_disconnect, NULL); 1994 &handle_client_disconnect, NULL);
1988 GNUNET_SERVER_add_handlers (server, 1995 GNUNET_SERVER_add_handlers (server,
1989 server_handlers); 1996 server_handlers);
1997 _GSS_statistics = GNUNET_STATISTICS_create ("set", cfg);
1990 cadet = GNUNET_CADET_connect (cfg, NULL, 1998 cadet = GNUNET_CADET_connect (cfg, NULL,
1991 &channel_new_cb, 1999 &channel_new_cb,
1992 &channel_end_cb, 2000 &channel_end_cb,
diff --git a/src/set/gnunet-service-set.h b/src/set/gnunet-service-set.h
index bc3052f02..982967744 100644
--- a/src/set/gnunet-service-set.h
+++ b/src/set/gnunet-service-set.h
@@ -589,6 +589,9 @@ struct Set
589}; 589};
590 590
591 591
592extern struct GNUNET_STATISTICS_Handle *_GSS_statistics;
593
594
592/** 595/**
593 * Destroy the given operation. Call the implementation-specific 596 * Destroy the given operation. Call the implementation-specific
594 * cancel function of the operation. Disconnects from the remote 597 * cancel function of the operation. Disconnects from the remote
diff --git a/src/set/gnunet-service-set_union.c b/src/set/gnunet-service-set_union.c
index 2940c3c2d..04fbba348 100644
--- a/src/set/gnunet-service-set_union.c
+++ b/src/set/gnunet-service-set_union.c
@@ -24,6 +24,7 @@
24 */ 24 */
25#include "platform.h" 25#include "platform.h"
26#include "gnunet_util_lib.h" 26#include "gnunet_util_lib.h"
27#include "gnunet_statistics_service.h"
27#include "gnunet-service-set.h" 28#include "gnunet-service-set.h"
28#include "ibf.h" 29#include "ibf.h"
29#include "gnunet-service-set_union_strata_estimator.h" 30#include "gnunet-service-set_union_strata_estimator.h"
@@ -796,10 +797,18 @@ decode_and_send (struct Operation *op)
796 LOG (GNUNET_ERROR_TYPE_DEBUG, 797 LOG (GNUNET_ERROR_TYPE_DEBUG,
797 "decoding failed, sending larger ibf (size %u)\n", 798 "decoding failed, sending larger ibf (size %u)\n",
798 1<<next_order); 799 1<<next_order);
800 GNUNET_STATISTICS_update (_GSS_statistics,
801 "# of IBF retries",
802 1,
803 GNUNET_NO);
799 send_ibf (op, next_order); 804 send_ibf (op, next_order);
800 } 805 }
801 else 806 else
802 { 807 {
808 GNUNET_STATISTICS_update (_GSS_statistics,
809 "# of failed union operations (too large)",
810 1,
811 GNUNET_NO);
803 // XXX: Send the whole set, element-by-element 812 // XXX: Send the whole set, element-by-element
804 LOG (GNUNET_ERROR_TYPE_ERROR, 813 LOG (GNUNET_ERROR_TYPE_ERROR,
805 "set union failed: reached ibf limit\n"); 814 "set union failed: reached ibf limit\n");
@@ -1094,10 +1103,19 @@ handle_p2p_elements (void *cls,
1094 (unsigned int) element_size, 1103 (unsigned int) element_size,
1095 GNUNET_h2s (&ee->element_hash)); 1104 GNUNET_h2s (&ee->element_hash));
1096 1105
1106 GNUNET_STATISTICS_update (_GSS_statistics,
1107 "# received elements",
1108 1,
1109 GNUNET_NO);
1110
1097 if (GNUNET_YES == op_has_element (op, &ee->element_hash)) 1111 if (GNUNET_YES == op_has_element (op, &ee->element_hash))
1098 { 1112 {
1099 /* Got repeated element. Should not happen since 1113 /* Got repeated element. Should not happen since
1100 * we track demands. */ 1114 * we track demands. */
1115 GNUNET_STATISTICS_update (_GSS_statistics,
1116 "# repeated elements",
1117 1,
1118 GNUNET_NO);
1101 GNUNET_break (0); 1119 GNUNET_break (0);
1102 GNUNET_free (ee); 1120 GNUNET_free (ee);
1103 } 1121 }
@@ -1379,6 +1397,10 @@ union_evaluate (struct Operation *op,
1379 op->state->phase = PHASE_EXPECT_SE; 1397 op->state->phase = PHASE_EXPECT_SE;
1380 LOG (GNUNET_ERROR_TYPE_DEBUG, 1398 LOG (GNUNET_ERROR_TYPE_DEBUG,
1381 "Initiating union operation evaluation\n"); 1399 "Initiating union operation evaluation\n");
1400 GNUNET_STATISTICS_update (_GSS_statistics,
1401 "# of initiated union operations",
1402 1,
1403 GNUNET_NO);
1382 ev = GNUNET_MQ_msg_nested_mh (msg, 1404 ev = GNUNET_MQ_msg_nested_mh (msg,
1383 GNUNET_MESSAGE_TYPE_SET_P2P_OPERATION_REQUEST, 1405 GNUNET_MESSAGE_TYPE_SET_P2P_OPERATION_REQUEST,
1384 opaque_context); 1406 opaque_context);
@@ -1415,6 +1437,12 @@ union_accept (struct Operation *op)
1415 LOG (GNUNET_ERROR_TYPE_DEBUG, 1437 LOG (GNUNET_ERROR_TYPE_DEBUG,
1416 "accepting set union operation\n"); 1438 "accepting set union operation\n");
1417 GNUNET_assert (NULL == op->state); 1439 GNUNET_assert (NULL == op->state);
1440
1441 GNUNET_STATISTICS_update (_GSS_statistics,
1442 "# of accepted union operations",
1443 1,
1444 GNUNET_NO);
1445
1418 op->state = GNUNET_new (struct OperationState); 1446 op->state = GNUNET_new (struct OperationState);
1419 op->state->se = strata_estimator_dup (op->spec->set->state->se); 1447 op->state->se = strata_estimator_dup (op->spec->set->state->se);
1420 op->state->demanded_hashes = GNUNET_CONTAINER_multihashmap_create (32, GNUNET_NO); 1448 op->state->demanded_hashes = GNUNET_CONTAINER_multihashmap_create (32, GNUNET_NO);