gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [gnunet] branch master updated (e331d5f6d -> ea51d048c)


From: gnunet
Subject: [GNUnet-SVN] [gnunet] branch master updated (e331d5f6d -> ea51d048c)
Date: Wed, 04 Apr 2018 08:54:45 +0200

This is an automated email from the git hooks/post-receive script.

julius-buenger pushed a change to branch master
in repository gnunet.

    from e331d5f6d start REST documentation
     new 0d0a91e78 rps profiler: fix logging of statistic values
     new 592845547 rps service/config: rename option in config, too
     new 2f2506d4a rps service: log view size on history update, too
     new dd4322b37 rps profiler: change logging format of view sizes
     new 2b07d8d5f rps tests: be more flexible with logging to files
     new ea51d048c rps tests: connect to all services

The 6 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/rps/gnunet-service-rps.c |   7 +++
 src/rps/rps-test_util.c      |  12 ++--
 src/rps/test_rps.c           | 128 ++++++++++++++++++++++---------------------
 src/rps/test_rps.conf        |   2 +-
 4 files changed, 80 insertions(+), 69 deletions(-)

diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c
index 30d677849..5b7f78b3f 100644
--- a/src/rps/gnunet-service-rps.c
+++ b/src/rps/gnunet-service-rps.c
@@ -2270,6 +2270,12 @@ insert_in_view (const struct GNUNET_PeerIdentity *peer)
 }
 
 /**
+ * @brief sends updates to clients that are interested
+ */
+static void
+clients_notify_view_update (void);
+
+/**
  * Put random peer from sampler into the view as history update.
  */
 static void
@@ -2279,6 +2285,7 @@ hist_update (void *cls,
 {
   unsigned int i;
 
+  clients_notify_view_update();
   for (i = 0; i < num_peers; i++)
   {
     (void) insert_in_view (&ids[i]);
diff --git a/src/rps/rps-test_util.c b/src/rps/rps-test_util.c
index e492b76b7..f57a55155 100644
--- a/src/rps/rps-test_util.c
+++ b/src/rps/rps-test_util.c
@@ -43,6 +43,7 @@ to_file_ (char *file_name, char *line)
 {
   struct GNUNET_DISK_FileHandle *f;
   char output_buffer[512];
+  size_t output_buffer_size = 512;
   char *output_buffer_p;
   //size_t size;
   int size;
@@ -63,16 +64,17 @@ to_file_ (char *file_name, char *line)
          file_name);
     return;
   }
-  if (512 < strlen (line) + 18)
+  output_buffer_size = strlen (line) + 18;
+  if (512 < output_buffer_size)
   {
-    output_buffer_p = GNUNET_malloc ((strlen (line) + 18) * sizeof (char));
+    output_buffer_p = GNUNET_malloc ((output_buffer_size) * sizeof (char));
   } else {
     output_buffer_p = &output_buffer[0];
   }
   size = GNUNET_snprintf (output_buffer_p,
-                          sizeof (output_buffer_p),
+                          output_buffer_size,
                           "%llu %s\n",
-                          GNUNET_TIME_absolute_get ().abs_value_us,
+                          (GNUNET_TIME_absolute_get ().abs_value_us) / 
1000000, // microsec -> sec
                           line);
   if (0 > size)
   {
@@ -97,7 +99,7 @@ to_file_ (char *file_name, char *line)
     return;
   }
 
-  if (512 < strlen (line) + 18)
+  if (512 < output_buffer_size)
   {
     GNUNET_free (output_buffer_p);
   }
diff --git a/src/rps/test_rps.c b/src/rps/test_rps.c
index 93a406aaf..660ac541a 100644
--- a/src/rps/test_rps.c
+++ b/src/rps/test_rps.c
@@ -1901,11 +1901,7 @@ void compute_diversity ()
 void print_view_sizes()
 {
   uint32_t i;
-  char *view_sizes_str = NULL;
-  uint32_t view_sizes_str_len = 0;
-  char view_size_curr[32] = { 0 };
 
-  GNUNET_array_grow (view_sizes_str, view_sizes_str_len, num_peers * 3);
   for (i = 0; i < num_peers; i++) /* Peer to count */
   {
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -1913,19 +1909,7 @@ void print_view_sizes()
                i,
                GNUNET_i2s (rps_peers[i].peer_id),
                rps_peers[i].cur_view_count);
-    GNUNET_snprintf (view_size_curr,
-                     sizeof (view_size_curr),
-                     " %" PRIu32 "",
-                     rps_peers[i].cur_view_count);
-    if (view_sizes_str_len < view_sizes_str_len + strlen (view_size_curr))
-    {
-      GNUNET_array_grow (view_sizes_str, view_sizes_str_len, 
view_sizes_str_len + 10);
-    }
-    strncat (view_sizes_str, view_size_curr, strlen(view_size_curr));
   }
-  to_file_ ("/tmp/rps/view_sizes.txt",
-           view_sizes_str);
-  GNUNET_array_grow (view_sizes_str, view_sizes_str_len, 0);
 }
 
 void all_views_updated_cb()
@@ -1941,6 +1925,10 @@ void view_update_cb (void *cls,
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "View was updated (%" PRIu64 ")\n", num_peers);
   struct RPSPeer *rps_peer = (struct RPSPeer *) cls;
+  to_file ("/tmp/rps/view_sizes.txt",
+         "%" PRIu64 " %" PRIu32 "",
+         rps_peer->index,
+         num_peers);
   for (int i = 0; i < num_peers; i++)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -1968,11 +1956,14 @@ void write_final_stats (void){
   for (i = 0; i < num_peers; i++)
   {
     to_file ("/tmp/rps/final_stats.dat",
-             "%s %" PRIu64
-             " %" PRIu64 " %" PRIu64 " %" PRIu64 " %" PRIu64 " %" PRIu64 " %" 
PRIu64 /* blocking */
-             " %" PRIu64 " %" PRIu64 " %" PRIu64 /* issued */
-             " %" PRIu64 " %" PRIu64 " %" PRIu64 /* sent */
-             " %" PRIu64 " %" PRIu64 " %" PRIu64 /* recv */,
+             "%" PRIu32 " " /* index */
+             "%s %" /* id */
+             PRIu64 " %" /* rounds */
+             PRIu64 " %" PRIu64 " %" PRIu64 " %" PRIu64 " %" PRIu64 " %" 
PRIu64 " %" /* blocking */
+             PRIu64 " %" PRIu64 " %" PRIu64 " %" /* issued */
+             PRIu64 " %" PRIu64 " %" PRIu64 " %" /* sent */
+             PRIu64 " %" PRIu64 " %" PRIu64 /* recv */,
+             i,
              GNUNET_i2s (rps_peers[i].peer_id),
              rps_peers[i].num_rounds,
              rps_peers[i].num_blocks,
@@ -2049,67 +2040,67 @@ post_test_shutdown_ready_cb (void *cls,
  */
 enum STAT_TYPE stat_str_2_type (const char *stat_str)
 {
-  if (GNUNET_YES == strncmp ("# rounds", stat_str, strlen ("# rounds")))
+  if (0 == strncmp ("# rounds blocked - no pull replies", stat_str, strlen ("# 
rounds blocked - no pull replies")))
   {
-    return STAT_TYPE_ROUNDS;
+    return STAT_TYPE_BLOCKS_NO_PULL;
   }
-  if (GNUNET_YES == strncmp ("# rounds blocked", stat_str, strlen ("# rounds 
blocked")))
+  else if (0 == strncmp ("# rounds blocked - too many pushes, no pull 
replies", stat_str, strlen ("# rounds blocked - too many pushes, no pull 
replies")))
   {
-    return STAT_TYPE_BLOCKS;
+    return STAT_TYPE_BLOCKS_MANY_PUSH_NO_PULL;
   }
-  if (0 == strncmp ("# rounds blocked - too many pushes", stat_str, strlen ("# 
rounds blocked - too many pushes")))
+  else if (0 == strncmp ("# rounds blocked - too many pushes", stat_str, 
strlen ("# rounds blocked - too many pushes")))
   {
     return STAT_TYPE_BLOCKS_MANY_PUSH;
   }
-  if (0 == strncmp ("# rounds blocked - no pushes", stat_str, strlen ("# 
rounds blocked - no pushes")))
+  else if (0 == strncmp ("# rounds blocked - no pushes, no pull replies", 
stat_str, strlen ("# rounds blocked - no pushes, no pull replies")))
   {
-    return STAT_TYPE_BLOCKS_NO_PUSH;
+    return STAT_TYPE_BLOCKS_NO_PUSH_NO_PULL;
   }
-  if (0 == strncmp ("# rounds blocked - no pull replies", stat_str, strlen ("# 
rounds blocked - no pull replies")))
+  else if (0 == strncmp ("# rounds blocked - no pushes", stat_str, strlen ("# 
rounds blocked - no pushes")))
   {
-    return STAT_TYPE_BLOCKS_NO_PULL;
+    return STAT_TYPE_BLOCKS_NO_PUSH;
   }
-  if (0 == strncmp ("# rounds blocked - too many pushes, no pull replies", 
stat_str, strlen ("# rounds blocked - too many pushes, no pull replies")))
+  else if (0 == strncmp ("# rounds blocked", stat_str, strlen ("# rounds 
blocked")))
   {
-    return STAT_TYPE_BLOCKS_MANY_PUSH_NO_PULL;
+    return STAT_TYPE_BLOCKS;
   }
-  if (0 == strncmp ("# rounds blocked - no pushes, no pull replies", stat_str, 
strlen ("# rounds blocked - no pushes, no pull replies")))
+  else if (0 == strncmp ("# rounds", stat_str, strlen ("# rounds")))
   {
-    return STAT_TYPE_BLOCKS_NO_PUSH_NO_PULL;
+    return STAT_TYPE_ROUNDS;
   }
-  if (0 == strncmp ("# push send issued", stat_str, strlen ("# push send 
issued")))
+  else if (0 == strncmp ("# push send issued", stat_str, strlen ("# push send 
issued")))
   {
     return STAT_TYPE_ISSUED_PUSH_SEND;
   }
-  if (0 == strncmp ("# pull request send issued", stat_str, strlen ("# pull 
request send issued")))
+  else if (0 == strncmp ("# pull request send issued", stat_str, strlen ("# 
pull request send issued")))
   {
     return STAT_TYPE_ISSUED_PULL_REQ;
   }
-  if (0 == strncmp ("# pull reply send issued", stat_str, strlen ("# pull 
reply send issued")))
+  else if (0 == strncmp ("# pull reply send issued", stat_str, strlen ("# pull 
reply send issued")))
   {
     return STAT_TYPE_ISSUED_PULL_REP;
   }
-  if (0 == strncmp ("# pushes sent", stat_str, strlen ("# pushes sent")))
+  else if (0 == strncmp ("# pushes sent", stat_str, strlen ("# pushes sent")))
   {
     return STAT_TYPE_SENT_PUSH_SEND;
   }
-  if (0 == strncmp ("# pull requests sent", stat_str, strlen ("# pull requests 
sent")))
+  else if (0 == strncmp ("# pull requests sent", stat_str, strlen ("# pull 
requests sent")))
   {
     return STAT_TYPE_SENT_PULL_REQ;
   }
-  if (0 == strncmp ("# pull replys sent", stat_str, strlen ("# pull replys 
sent")))
+  else if (0 == strncmp ("# pull replys sent", stat_str, strlen ("# pull 
replys sent")))
   {
     return STAT_TYPE_SENT_PULL_REP;
   }
-  if (0 == strncmp ("# push message received", stat_str, strlen ("# push 
message received")))
+  else if (0 == strncmp ("# push message received", stat_str, strlen ("# push 
message received")))
   {
     return STAT_TYPE_RECV_PUSH_SEND;
   }
-  if (0 == strncmp ("# pull request message received", stat_str, strlen ("# 
pull request message received")))
+  else if (0 == strncmp ("# pull request message received", stat_str, strlen 
("# pull request message received")))
   {
     return STAT_TYPE_RECV_PULL_REQ;
   }
-  if (0 == strncmp ("# pull reply messages received", stat_str, strlen ("# 
pull reply messages received")))
+  else if (0 == strncmp ("# pull reply messages received", stat_str, strlen 
("# pull reply messages received")))
   {
     return STAT_TYPE_RECV_PULL_REP;
   }
@@ -2191,49 +2182,66 @@ stat_iterator (void *cls,
       //stat_type_2_str (stat_cls->stat_type),
       name,
       value);
-  //to_file (rps_peer->file_name_stats,
-  //        "%s: %" PRIu64 "\n",
-  //        name,
-  //        value);
+  to_file (rps_peer->file_name_stats,
+          "%s: %" PRIu64 "\n",
+          name,
+          value);
   switch (stat_str_2_type (name))
   {
     case STAT_TYPE_ROUNDS:
-      rps_peer->num_blocks = value;
+      rps_peer->num_rounds = value;
+      break;
     case STAT_TYPE_BLOCKS:
       rps_peer->num_blocks = value;
+      break;
     case STAT_TYPE_BLOCKS_MANY_PUSH:
       rps_peer->num_blocks_many_push = value;
+      break;
     case STAT_TYPE_BLOCKS_NO_PUSH:
       rps_peer->num_blocks_no_push = value;
+      break;
     case STAT_TYPE_BLOCKS_NO_PULL:
       rps_peer->num_blocks_no_pull = value;
+      break;
     case STAT_TYPE_BLOCKS_MANY_PUSH_NO_PULL:
       rps_peer->num_blocks_many_push_no_pull = value;
+      break;
     case STAT_TYPE_BLOCKS_NO_PUSH_NO_PULL:
       rps_peer->num_blocks_no_push_no_pull = value;
+      break;
     case STAT_TYPE_ISSUED_PUSH_SEND:
       rps_peer->num_issued_push = value;
+      break;
     case STAT_TYPE_ISSUED_PULL_REQ:
       rps_peer->num_issued_pull_req = value;
+      break;
     case STAT_TYPE_ISSUED_PULL_REP:
       rps_peer->num_issued_pull_rep = value;
+      break;
     case STAT_TYPE_SENT_PUSH_SEND:
       rps_peer->num_sent_push = value;
+      break;
     case STAT_TYPE_SENT_PULL_REQ:
       rps_peer->num_sent_pull_req = value;
+      break;
     case STAT_TYPE_SENT_PULL_REP:
       rps_peer->num_sent_pull_rep = value;
+      break;
     case STAT_TYPE_RECV_PUSH_SEND:
       rps_peer->num_recv_push = value;
+      break;
     case STAT_TYPE_RECV_PULL_REQ:
       rps_peer->num_recv_pull_req = value;
+      break;
     case STAT_TYPE_RECV_PULL_REP:
       rps_peer->num_recv_pull_rep = value;
+      break;
     case STAT_TYPE_MAX:
     default:
       GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
                  "Unknown statistics string: %s\n",
                  name);
+      break;
   }
   return GNUNET_OK;
 }
@@ -2303,7 +2311,6 @@ run (void *cls,
 {
   unsigned int i;
   struct OpListEntry *entry;
-  uint32_t num_mal_peers;
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "RUN was called\n");
 
@@ -2344,24 +2351,19 @@ run (void *cls,
   }
 
   /* Bring peers up */
-  num_mal_peers = round (portion * num_peers);
   GNUNET_assert (num_peers == n_peers);
   for (i = 0; i < n_peers; i++)
   {
     rps_peers[i].index = i;
-    if ( (rps_peers[i].num_recv_ids < rps_peers[i].num_ids_to_request) ||
-         (i < num_mal_peers) )
-    {
-      rps_peers[i].op =
-        GNUNET_TESTBED_service_connect (&rps_peers[i],
-                                        peers[i],
-                                        "rps",
-                                        &rps_connect_complete_cb,
-                                        &rps_peers[i],
-                                        &rps_connect_adapter,
-                                        &rps_disconnect_adapter,
-                                        &rps_peers[i]);
-    }
+    rps_peers[i].op =
+      GNUNET_TESTBED_service_connect (&rps_peers[i],
+                                      peers[i],
+                                      "rps",
+                                      &rps_connect_complete_cb,
+                                      &rps_peers[i],
+                                      &rps_connect_adapter,
+                                      &rps_disconnect_adapter,
+                                      &rps_peers[i]);
     /* Connect all peers to statistics service */
     if (COLLECT_STATISTICS == cur_test_run.have_collect_statistics)
     {
diff --git a/src/rps/test_rps.conf b/src/rps/test_rps.conf
index fce07c945..0b49b4e76 100644
--- a/src/rps/test_rps.conf
+++ b/src/rps/test_rps.conf
@@ -19,7 +19,7 @@ FILENAME_VALID_PEERS = $GNUNET_DATA_HOME/rps/valid_peers.txt
 # until we receive the first estimate from NSE.
 # Keep in mind, that (networksize)^(1/3) should be enough.
 # So, 50 is enough for a network of size 50^3 = 125000
-INITSIZE = 4
+MINSIZE = 4
 
 [testbed]
 HOSTNAME = localhost

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

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