gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [gnunet] branch master updated: rps profiler: log view coun


From: gnunet
Subject: [GNUnet-SVN] [gnunet] branch master updated: rps profiler: log view counts
Date: Thu, 05 Apr 2018 01:12:10 +0200

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

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

The following commit(s) were added to refs/heads/master by this push:
     new e645cf219 rps profiler: log view counts
e645cf219 is described below

commit e645cf2194cf309c9597b21dc7d4fd2d011777e0
Author: Julius Bünger <address@hidden>
AuthorDate: Thu Apr 5 01:10:28 2018 +0200

    rps profiler: log view counts
---
 src/rps/test_rps.c | 32 +++++++++++++++++++++++++++++++-
 1 file changed, 31 insertions(+), 1 deletion(-)

diff --git a/src/rps/test_rps.c b/src/rps/test_rps.c
index 660ac541a..e28210ed4 100644
--- a/src/rps/test_rps.c
+++ b/src/rps/test_rps.c
@@ -270,6 +270,11 @@ struct RPSPeer
   uint32_t cur_view_count;
 
   /**
+   * @brief Number of occurrences in other peer's view
+   */
+  uint32_t count_in_views;
+
+  /**
    * @brief statistics values
    */
   uint64_t num_rounds;
@@ -1838,7 +1843,28 @@ store_stats_file_name (struct RPSPeer *rps_peer)
   rps_peer->file_name_stats = file_name;
 }
 
-void count_peer_in_views (uint32_t *count_peers)
+static uint32_t count_peer_in_views_2 (uint32_t peer_idx)
+{
+  uint32_t i, j;
+  uint32_t count = 0;
+
+  for (i = 0; i < num_peers; i++) /* Peer in which view is counted */
+  {
+    for (j = 0; j < rps_peers[i].cur_view_count; j++) /* entry in view */
+    {
+      if (0 == memcmp (rps_peers[peer_idx].peer_id,
+            &rps_peers[i].cur_view[j],
+            sizeof (struct GNUNET_PeerIdentity)))
+      {
+        count++;
+      }
+    }
+  }
+  rps_peers[peer_idx].count_in_views = count;
+  return count;
+}
+
+static void count_peer_in_views (uint32_t *count_peers)
 {
   uint32_t i, j;
 
@@ -1941,6 +1967,10 @@ void view_update_cb (void *cls,
   memcpy (rps_peer->cur_view,
           peers,
           num_peers * 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));
   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]