rps: record more statistic values
authorJulius Bünger <buenger@mytum.de>
Thu, 25 Jan 2018 15:05:35 +0000 (16:05 +0100)
committerJulius Bünger <buenger@mytum.de>
Thu, 25 Jan 2018 15:05:35 +0000 (16:05 +0100)
src/rps/gnunet-service-rps.c
src/rps/test_rps.c

index aeb0eabc2657fe7305815561e9bb9f52606bce3d..56c3c52b6f86ffab95b497d18c7b1127cf7c0de8 100644 (file)
@@ -3727,14 +3727,36 @@ do_round (void *cls)
   } else {
     LOG (GNUNET_ERROR_TYPE_DEBUG, "No update of the view.\n");
     GNUNET_STATISTICS_update(stats, "# rounds blocked", 1, GNUNET_NO);
-    if (CustomPeerMap_size (push_map) > alpha * View_size ())
+    if (CustomPeerMap_size (push_map) > alpha * View_size () &&
+        !(0 >= CustomPeerMap_size (pull_map)))
       GNUNET_STATISTICS_update(stats, "# rounds blocked - too many pushes", 1, GNUNET_NO);
-    if (0 >= CustomPeerMap_size (push_map))
+    if (CustomPeerMap_size (push_map) > alpha * View_size () &&
+        (0 >= CustomPeerMap_size (pull_map)))
+      GNUNET_STATISTICS_update(stats, "# rounds blocked - too many pushes, no pull replies", 1, GNUNET_NO);
+    if (0 >= CustomPeerMap_size (push_map) &&
+        !(0 >= CustomPeerMap_size (pull_map)))
       GNUNET_STATISTICS_update(stats, "# rounds blocked - no pushes", 1, GNUNET_NO);
-    if (0 >= CustomPeerMap_size (pull_map))
+    if (0 >= CustomPeerMap_size (push_map) &&
+        (0 >= CustomPeerMap_size (pull_map)))
+      GNUNET_STATISTICS_update(stats, "# rounds blocked - no pushes, no pull replies", 1, GNUNET_NO);
+    if (0 >= CustomPeerMap_size (pull_map) &&
+        CustomPeerMap_size (push_map) > alpha * View_size () &&
+        0 >= CustomPeerMap_size (push_map))
       GNUNET_STATISTICS_update(stats, "# rounds blocked - no pull replies", 1, GNUNET_NO);
   }
   // TODO independent of that also get some peers from CADET_get_peers()?
+  GNUNET_STATISTICS_set (stats,
+      "# peers in push map at end of round",
+      CustomPeerMap_size (push_map),
+      GNUNET_NO);
+  GNUNET_STATISTICS_set (stats,
+      "# peers in pull map at end of round",
+      CustomPeerMap_size (pull_map),
+      GNUNET_NO);
+  GNUNET_STATISTICS_set (stats,
+      "# peers in view at end of round",
+      View_size (),
+      GNUNET_NO);
 
   LOG (GNUNET_ERROR_TYPE_DEBUG,
        "Received %u pushes and %u pulls last round (alpha (%.2f) * view_size (%u) = %.2f)\n",
index cba992740a2df2b91c47515a701fd36ef209c6bf..d304adfe2140944e8346565b82c4b65b64e09106 100644 (file)
@@ -262,20 +262,22 @@ struct RPSPeer
 
 enum STAT_TYPE
 {
-  STAT_TYPE_ROUNDS           =    0x1, /*   1 */
-  STAT_TYPE_BLOCKS           =    0x2, /*   2 */
-  STAT_TYPE_BLOCKS_MANY_PUSH =    0x4, /*   3 */
-  STAT_TYPE_BLOCKS_FEW_PUSH  =    0x8, /*   4 */
-  STAT_TYPE_BLOCKS_FEW_PULL  =   0x10, /*   5 */
-  STAT_TYPE_ISSUED_PUSH_SEND =   0x20, /*   6 */
-  STAT_TYPE_ISSUED_PULL_REQ  =   0x40, /*   7 */
-  STAT_TYPE_ISSUED_PULL_REP  =   0x80, /*   8 */
-  STAT_TYPE_SENT_PUSH_SEND   =  0x100, /*   9 */
-  STAT_TYPE_SENT_PULL_REQ    =  0x200, /*  10 */
-  STAT_TYPE_SENT_PULL_REP    =  0x400, /*  11 */
-  STAT_TYPE_RECV_PUSH_SEND   =  0x800, /*  12 */
-  STAT_TYPE_RECV_PULL_REQ    = 0x1000, /*  13 */
-  STAT_TYPE_RECV_PULL_REP    = 0x2000, /*  14 */
+  STAT_TYPE_ROUNDS                    =    0x1, /*   1 */
+  STAT_TYPE_BLOCKS                    =    0x2, /*   2 */
+  STAT_TYPE_BLOCKS_MANY_PUSH          =    0x4, /*   3 */
+  STAT_TYPE_BLOCKS_NO_PUSH            =    0x8, /*   4 */
+  STAT_TYPE_BLOCKS_NO_PULL            =   0x10, /*   5 */
+  STAT_TYPE_BLOCKS_MANY_PUSH_NO_PULL  =   0x20, /*   6 */
+  STAT_TYPE_BLOCKS_NO_PUSH_NO_PULL    =   0x40, /*   7 */
+  STAT_TYPE_ISSUED_PUSH_SEND          =   0x80, /*   8 */
+  STAT_TYPE_ISSUED_PULL_REQ           =  0x100, /*   9 */
+  STAT_TYPE_ISSUED_PULL_REP           =  0x200, /*  10 */
+  STAT_TYPE_SENT_PUSH_SEND            =  0x400, /*  11 */
+  STAT_TYPE_SENT_PULL_REQ             =  0x800, /*  12 */
+  STAT_TYPE_SENT_PULL_REP             = 0x1000, /*  13 */
+  STAT_TYPE_RECV_PUSH_SEND            = 0x2000, /*  14 */
+  STAT_TYPE_RECV_PULL_REQ             = 0x4000, /*  15 */
+  STAT_TYPE_RECV_PULL_REP             = 0x8000, /*  16 */
   STAT_TYPE_MAX          = 0x80000000, /*  32 */
 };
 
@@ -1850,10 +1852,14 @@ char* stat_type_2_str (enum STAT_TYPE stat_type)
       return "# rounds blocked";
     case STAT_TYPE_BLOCKS_MANY_PUSH:
       return "# rounds blocked - too many pushes";
-    case STAT_TYPE_BLOCKS_FEW_PUSH:
+    case STAT_TYPE_BLOCKS_NO_PUSH:
       return "# rounds blocked - no pushes";
-    case STAT_TYPE_BLOCKS_FEW_PULL:
+    case STAT_TYPE_BLOCKS_NO_PULL:
       return "# rounds blocked - no pull replies";
+    case STAT_TYPE_BLOCKS_MANY_PUSH_NO_PULL:
+      return "# rounds blocked - too many pushes, no pull replies";
+    case STAT_TYPE_BLOCKS_NO_PUSH_NO_PULL:
+      return "# rounds blocked - no pushes, no pull replies";
     case STAT_TYPE_ISSUED_PUSH_SEND:
       return "# push send issued";
     case STAT_TYPE_ISSUED_PULL_REQ:
@@ -2197,8 +2203,10 @@ main (int argc, char *argv[])
     cur_test_run.stat_collect_flags = STAT_TYPE_ROUNDS |
                                       STAT_TYPE_BLOCKS |
                                       STAT_TYPE_BLOCKS_MANY_PUSH |
-                                      STAT_TYPE_BLOCKS_FEW_PUSH |
-                                      STAT_TYPE_BLOCKS_FEW_PULL |
+                                      STAT_TYPE_BLOCKS_NO_PUSH |
+                                      STAT_TYPE_BLOCKS_NO_PULL |
+                                      STAT_TYPE_BLOCKS_MANY_PUSH_NO_PULL |
+                                      STAT_TYPE_BLOCKS_NO_PUSH_NO_PULL |
                                       STAT_TYPE_ISSUED_PUSH_SEND |
                                       STAT_TYPE_ISSUED_PULL_REQ |
                                       STAT_TYPE_ISSUED_PULL_REP |