From c53cced7bc23c27544a48a6b515b6f6407e4bfa3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Julius=20B=C3=BCnger?= Date: Thu, 25 Jan 2018 16:05:35 +0100 Subject: [PATCH] rps: record more statistic values --- src/rps/gnunet-service-rps.c | 28 ++++++++++++++++++++--- src/rps/test_rps.c | 44 +++++++++++++++++++++--------------- 2 files changed, 51 insertions(+), 21 deletions(-) diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c index aeb0eabc2..56c3c52b6 100644 --- a/src/rps/gnunet-service-rps.c +++ b/src/rps/gnunet-service-rps.c @@ -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", diff --git a/src/rps/test_rps.c b/src/rps/test_rps.c index cba992740..d304adfe2 100644 --- a/src/rps/test_rps.c +++ b/src/rps/test_rps.c @@ -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 | -- 2.25.1