gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [gnunet] branch master updated (9c9773bbd -> 1f754809a)


From: gnunet
Subject: [GNUnet-SVN] [gnunet] branch master updated (9c9773bbd -> 1f754809a)
Date: Fri, 06 Apr 2018 12:43:29 +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 9c9773bbd starting tool for zone import (very incomplete)
     new a42b440b3 rps service fix: properly initialize view
     new 1f754809a rps profiler: collect more data

The 2 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 |  2 +-
 src/rps/test_rps.c           | 56 +++++++++++++++++++++++++++++++++++++++-----
 2 files changed, 51 insertions(+), 7 deletions(-)

diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c
index 3416fc10c..c23a64285 100644
--- a/src/rps/gnunet-service-rps.c
+++ b/src/rps/gnunet-service-rps.c
@@ -4268,7 +4268,7 @@ run (void *cls,
   }
 
 
-  View_create (4);
+  View_create (view_size_est_min);
 
   /* file_name_view_log */
   if (GNUNET_OK != GNUNET_DISK_directory_create ("/tmp/rps/"))
diff --git a/src/rps/test_rps.c b/src/rps/test_rps.c
index e28210ed4..6ee665ad5 100644
--- a/src/rps/test_rps.c
+++ b/src/rps/test_rps.c
@@ -354,6 +354,11 @@ static struct RPSPeer *eval_peer;
 static unsigned int num_peers_online;
 
 /**
+ * @brief The added sizes of the peer's views
+ */
+static unsigned int view_sizes;
+
+/**
  * Return value from 'main'.
  */
 static int ok;
@@ -1843,6 +1848,15 @@ store_stats_file_name (struct RPSPeer *rps_peer)
   rps_peer->file_name_stats = file_name;
 }
 
+/**
+ * @brief This counts the number of peers in which views a given peer occurs.
+ *
+ * It also stores this value in the rps peer.
+ *
+ * @param peer_idx the index of the peer to count the representation
+ *
+ * @return the number of occurrences
+ */
 static uint32_t count_peer_in_views_2 (uint32_t peer_idx)
 {
   uint32_t i, j;
@@ -1857,6 +1871,7 @@ static uint32_t count_peer_in_views_2 (uint32_t peer_idx)
             sizeof (struct GNUNET_PeerIdentity)))
       {
         count++;
+        break;
       }
     }
   }
@@ -1864,6 +1879,18 @@ static uint32_t count_peer_in_views_2 (uint32_t peer_idx)
   return count;
 }
 
+static uint32_t cumulated_view_sizes ()
+{
+  uint32_t i;
+
+  view_sizes = 0;
+  for (i = 0; i < num_peers; i++) /* Peer in which view is counted */
+  {
+    view_sizes += rps_peers[i].cur_view_count;
+  }
+  return view_sizes;
+}
+
 static void count_peer_in_views (uint32_t *count_peers)
 {
   uint32_t i, j;
@@ -1945,32 +1972,49 @@ void all_views_updated_cb()
 }
 
 void view_update_cb (void *cls,
-                     uint64_t num_peers,
+                     uint64_t view_size,
                      const struct GNUNET_PeerIdentity *peers)
 {
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "View was updated (%" PRIu64 ")\n", num_peers);
+              "View was updated (%" PRIu64 ")\n", view_size);
   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++)
+         view_size);
+  for (int i = 0; i < view_size; i++)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                "\t%s\n", GNUNET_i2s (&peers[i]));
   }
   GNUNET_array_grow (rps_peer->cur_view,
                      rps_peer->cur_view_count,
-                     num_peers);
+                     view_size);
   //*rps_peer->cur_view = *peers;
   memcpy (rps_peer->cur_view,
           peers,
-          num_peers * sizeof (struct GNUNET_PeerIdentity));
+          view_size * sizeof (struct GNUNET_PeerIdentity));
   to_file ("/tmp/rps/count_in_views.txt",
          "%" PRIu64 " %" PRIu32 "",
          rps_peer->index,
          count_peer_in_views_2 (rps_peer->index));
+  cumulated_view_sizes();
+  to_file ("/tmp/rps/repr.txt",
+         "%" PRIu64 /* index */
+         " %" PRIu32 /* occurrence in views */
+         " %" PRIu32 /* view sizes */
+         " %f" /* fraction of repr in views */
+         " %f" /* average view size */
+         " %f" /* prob of occurrence in view slot */
+         " %f" "", /* exp frac of repr in views */
+         rps_peer->index,
+         count_peer_in_views_2 (rps_peer->index),
+         view_sizes,
+         count_peer_in_views_2 (rps_peer->index) / (view_size * 1.0), /* 
fraction of representation in views */
+         view_sizes / (view_size * 1.0), /* average view size */
+         1.0 /view_size, /* prob of occurrence in view slot */
+         (1.0/view_size) * (view_sizes/view_size) /* expected fraction of repr 
in views */
+         );
   all_views_updated_cb();
 }
 

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



reply via email to

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