gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r36753 - in gnunet/src: consensus set


From: gnunet
Subject: [GNUnet-SVN] r36753 - in gnunet/src: consensus set
Date: Thu, 10 Dec 2015 17:31:20 +0100

Author: dold
Date: 2015-12-10 17:31:20 +0100 (Thu, 10 Dec 2015)
New Revision: 36753

Modified:
   gnunet/src/consensus/Makefile.am
   gnunet/src/consensus/gnunet-service-consensus.c
   gnunet/src/consensus/test_consensus.conf
   gnunet/src/set/gnunet-service-set_union.c
Log:
More statistics.


Modified: gnunet/src/consensus/Makefile.am
===================================================================
--- gnunet/src/consensus/Makefile.am    2015-12-10 14:17:12 UTC (rev 36752)
+++ gnunet/src/consensus/Makefile.am    2015-12-10 16:31:20 UTC (rev 36753)
@@ -46,6 +46,7 @@
   $(top_builddir)/src/util/libgnunetutil.la \
   $(top_builddir)/src/core/libgnunetcore.la \
   $(top_builddir)/src/set/libgnunetset.la \
+  $(top_builddir)/src/statistics/libgnunetstatistics.la \
   $(GN_LIBINTL)
 
 gnunet_service_evil_consensus_SOURCES = \
@@ -55,6 +56,7 @@
   $(top_builddir)/src/util/libgnunetutil.la \
   $(top_builddir)/src/core/libgnunetcore.la \
   $(top_builddir)/src/set/libgnunetset.la \
+  $(top_builddir)/src/statistics/libgnunetstatistics.la \
   $(GN_LIBINTL)
 gnunet_service_evil_consensus_CFLAGS = -DEVIL
 

Modified: gnunet/src/consensus/gnunet-service-consensus.c
===================================================================
--- gnunet/src/consensus/gnunet-service-consensus.c     2015-12-10 14:17:12 UTC 
(rev 36752)
+++ gnunet/src/consensus/gnunet-service-consensus.c     2015-12-10 16:31:20 UTC 
(rev 36753)
@@ -29,6 +29,7 @@
 #include "gnunet_protocols.h"
 #include "gnunet_applications.h"
 #include "gnunet_set_service.h"
+#include "gnunet_statistics_service.h"
 #include "gnunet_consensus_service.h"
 #include "consensus_protocol.h"
 #include "consensus.h"
@@ -485,7 +486,12 @@
  */
 static struct GNUNET_PeerIdentity my_peer;
 
+/**
+ * Statistics handle.
+ */
+struct GNUNET_STATISTICS_Handle *statistics;
 
+
 static void
 finish_task (struct TaskEntry *task);
 
@@ -1226,6 +1232,14 @@
     struct Evilness evil;
 
     get_evilness (session, &evil);
+    if (EVILNESS_NONE != evil.type)
+    {
+      /* Useful for evaluation */
+      GNUNET_STATISTICS_set (statistics,
+                             "is evil",
+                             1,
+                             GNUNET_NO);
+    }
     switch (evil.type)
     {
       case EVILNESS_CRAM_ALL:
@@ -1240,7 +1254,8 @@
           GNUNET_SET_commit (setop->op, set->h);
           break;
         }
-        if ((EVILNESS_CRAM_LEAD == evil.type) && (PHASE_KIND_GRADECAST_LEADER 
!= task->key.kind))
+        if ((EVILNESS_CRAM_LEAD == evil.type) &&
+            ((PHASE_KIND_GRADECAST_LEADER != task->key.kind) || 
SET_KIND_CURRENT != set->key.set_kind))
         {
           GNUNET_SET_commit (setop->op, set->h);
           break;
@@ -1282,6 +1297,10 @@
                       debug_str_task_key (&task->key));
 #endif
         }
+        GNUNET_STATISTICS_update (statistics,
+                                  "# stuffed elements",
+                                  evil.num,
+                                  GNUNET_NO);
         GNUNET_SET_commit (setop->op, set->h);
         break;
       case EVILNESS_SLACK:
@@ -1842,12 +1861,7 @@
                                     set_result_cb,
                                     task);
 
-    if (GNUNET_OK != GNUNET_SET_commit (setop->op, input->h))
-    {
-      GNUNET_break (0);
-      /* XXX: cleanup? */
-      return;
-    }
+    commit_set (session, task);
   }
   else if (task->key.peer2 == session->local_peer_idx)
   {
@@ -3006,6 +3020,7 @@
   while (NULL != sessions_head)
     destroy_session (sessions_head);
 
+  GNUNET_STATISTICS_destroy (statistics, GNUNET_YES);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "handled shutdown request\n");
 }
 
@@ -3058,6 +3073,7 @@
     GNUNET_SCHEDULER_shutdown ();
     return;
   }
+  statistics = GNUNET_STATISTICS_create ("consensus", cfg);
   GNUNET_SERVER_add_handlers (server, server_handlers);
   GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task, 
NULL);
   GNUNET_SERVER_disconnect_notify (server, handle_client_disconnect, NULL);

Modified: gnunet/src/consensus/test_consensus.conf
===================================================================
--- gnunet/src/consensus/test_consensus.conf    2015-12-10 14:17:12 UTC (rev 
36752)
+++ gnunet/src/consensus/test_consensus.conf    2015-12-10 16:31:20 UTC (rev 
36753)
@@ -5,7 +5,7 @@
 OPTIONS = -L INFO
 BINARY = gnunet-service-evil-consensus
 
-EVIL_SPEC = 0;cram-all;noreplace;5
+#EVIL_SPEC = 0;cram-all;noreplace;5
 #EVIL_SPEC = 0;cram;5/1;cram;5
 #EVIL_SPEC = 0;cram;5/1;cram;3
 

Modified: gnunet/src/set/gnunet-service-set_union.c
===================================================================
--- gnunet/src/set/gnunet-service-set_union.c   2015-12-10 14:17:12 UTC (rev 
36752)
+++ gnunet/src/set/gnunet-service-set_union.c   2015-12-10 16:31:20 UTC (rev 
36753)
@@ -1209,6 +1209,10 @@
                             "# received elements",
                             1,
                             GNUNET_NO);
+  GNUNET_STATISTICS_update (_GSS_statistics,
+                            "# exchanged elements",
+                            1,
+                            GNUNET_NO);
 
   if (GNUNET_YES == op_has_element (op, &ee->element_hash))
   {
@@ -1339,6 +1343,10 @@
          (unsigned int) ee->element.size,
          GNUNET_h2s (&ee->element_hash));
     GNUNET_MQ_send (op->mq, ev);
+    GNUNET_STATISTICS_update (_GSS_statistics,
+                              "# exchanged elements",
+                              1,
+                              GNUNET_NO);
 
     switch (op->spec->result_mode)
     {




reply via email to

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