gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r36475 - gnunet/src/set


From: gnunet
Subject: [GNUnet-SVN] r36475 - gnunet/src/set
Date: Wed, 7 Oct 2015 20:05:24 +0200

Author: dold
Date: 2015-10-07 20:05:23 +0200 (Wed, 07 Oct 2015)
New Revision: 36475

Modified:
   gnunet/src/set/Makefile.am
   gnunet/src/set/gnunet-service-set.c
   gnunet/src/set/gnunet-service-set.h
   gnunet/src/set/gnunet-service-set_union.c
Log:
set statistics


Modified: gnunet/src/set/Makefile.am
===================================================================
--- gnunet/src/set/Makefile.am  2015-10-07 17:02:23 UTC (rev 36474)
+++ gnunet/src/set/Makefile.am  2015-10-07 18:05:23 UTC (rev 36475)
@@ -50,6 +50,7 @@
  gnunet-service-set_protocol.h
 gnunet_service_set_LDADD = \
   $(top_builddir)/src/util/libgnunetutil.la \
+  $(top_builddir)/src/statistics/libgnunetstatistics.la \
   $(top_builddir)/src/core/libgnunetcore.la \
   $(top_builddir)/src/cadet/libgnunetcadet.la \
   $(top_builddir)/src/block/libgnunetblock.la \

Modified: gnunet/src/set/gnunet-service-set.c
===================================================================
--- gnunet/src/set/gnunet-service-set.c 2015-10-07 17:02:23 UTC (rev 36474)
+++ gnunet/src/set/gnunet-service-set.c 2015-10-07 18:05:23 UTC (rev 36475)
@@ -25,6 +25,7 @@
  */
 #include "gnunet-service-set.h"
 #include "gnunet-service-set_protocol.h"
+#include "gnunet_statistics_service.h"
 
 /**
  * How long do we hold on to an incoming channel if there is
@@ -137,7 +138,12 @@
  */
 static uint32_t suggest_id = 1;
 
+/**
+ * Statistics handle.
+ */
+struct GNUNET_STATISTICS_Handle *_GSS_statistics;
 
+
 /**
  * Get set that is owned by the given client, if any.
  *
@@ -1716,6 +1722,7 @@
     GNUNET_CADET_disconnect (cadet);
     cadet = NULL;
   }
+  GNUNET_STATISTICS_destroy (_GSS_statistics, GNUNET_YES);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "handled shutdown request\n");
 }
@@ -1987,6 +1994,7 @@
                                    &handle_client_disconnect, NULL);
   GNUNET_SERVER_add_handlers (server,
                               server_handlers);
+  _GSS_statistics = GNUNET_STATISTICS_create ("set", cfg);
   cadet = GNUNET_CADET_connect (cfg, NULL,
                                 &channel_new_cb,
                                 &channel_end_cb,

Modified: gnunet/src/set/gnunet-service-set.h
===================================================================
--- gnunet/src/set/gnunet-service-set.h 2015-10-07 17:02:23 UTC (rev 36474)
+++ gnunet/src/set/gnunet-service-set.h 2015-10-07 18:05:23 UTC (rev 36475)
@@ -589,6 +589,9 @@
 };
 
 
+extern struct GNUNET_STATISTICS_Handle *_GSS_statistics;
+
+
 /**
  * Destroy the given operation.  Call the implementation-specific
  * cancel function of the operation.  Disconnects from the remote

Modified: gnunet/src/set/gnunet-service-set_union.c
===================================================================
--- gnunet/src/set/gnunet-service-set_union.c   2015-10-07 17:02:23 UTC (rev 
36474)
+++ gnunet/src/set/gnunet-service-set_union.c   2015-10-07 18:05:23 UTC (rev 
36475)
@@ -24,6 +24,7 @@
  */
 #include "platform.h"
 #include "gnunet_util_lib.h"
+#include "gnunet_statistics_service.h"
 #include "gnunet-service-set.h"
 #include "ibf.h"
 #include "gnunet-service-set_union_strata_estimator.h"
@@ -796,10 +797,18 @@
         LOG (GNUNET_ERROR_TYPE_DEBUG,
              "decoding failed, sending larger ibf (size %u)\n",
              1<<next_order);
+        GNUNET_STATISTICS_update (_GSS_statistics,
+                                  "# of IBF retries",
+                                  1,
+                                  GNUNET_NO);
         send_ibf (op, next_order);
       }
       else
       {
+        GNUNET_STATISTICS_update (_GSS_statistics,
+                                  "# of failed union operations (too large)",
+                                  1,
+                                  GNUNET_NO);
         // XXX: Send the whole set, element-by-element
         LOG (GNUNET_ERROR_TYPE_ERROR,
              "set union failed: reached ibf limit\n");
@@ -1094,10 +1103,19 @@
        (unsigned int) element_size,
        GNUNET_h2s (&ee->element_hash));
 
+  GNUNET_STATISTICS_update (_GSS_statistics,
+                            "# received elements",
+                            1,
+                            GNUNET_NO);
+
   if (GNUNET_YES == op_has_element (op, &ee->element_hash))
   {
     /* Got repeated element.  Should not happen since
      * we track demands. */
+    GNUNET_STATISTICS_update (_GSS_statistics,
+                              "# repeated elements",
+                              1,
+                              GNUNET_NO);
     GNUNET_break (0);
     GNUNET_free (ee);
   }
@@ -1379,6 +1397,10 @@
   op->state->phase = PHASE_EXPECT_SE;
   LOG (GNUNET_ERROR_TYPE_DEBUG,
        "Initiating union operation evaluation\n");
+  GNUNET_STATISTICS_update (_GSS_statistics,
+                            "# of initiated union operations",
+                            1,
+                            GNUNET_NO);
   ev = GNUNET_MQ_msg_nested_mh (msg,
                                 GNUNET_MESSAGE_TYPE_SET_P2P_OPERATION_REQUEST,
                                 opaque_context);
@@ -1415,6 +1437,12 @@
   LOG (GNUNET_ERROR_TYPE_DEBUG,
        "accepting set union operation\n");
   GNUNET_assert (NULL == op->state);
+
+  GNUNET_STATISTICS_update (_GSS_statistics,
+                            "# of accepted union operations",
+                            1,
+                            GNUNET_NO);
+
   op->state = GNUNET_new (struct OperationState);
   op->state->se = strata_estimator_dup (op->spec->set->state->se);
   op->state->demanded_hashes = GNUNET_CONTAINER_multihashmap_create (32, 
GNUNET_NO);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]