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: fix computati


From: gnunet
Subject: [GNUnet-SVN] [gnunet] branch master updated: rps profiler: fix computation of probab, debugging
Date: Wed, 11 Apr 2018 14:42:47 +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 ae7bf7b65 rps profiler: fix computation of probab, debugging
ae7bf7b65 is described below

commit ae7bf7b653bd4977e94e29c3db73fdff8a8b8cfa
Author: Julius Bünger <address@hidden>
AuthorDate: Wed Apr 11 14:41:00 2018 +0200

    rps profiler: fix computation of probab, debugging
---
 src/rps/test_rps.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/rps/test_rps.c b/src/rps/test_rps.c
index 60a743167..fa2ffd9eb 100644
--- a/src/rps/test_rps.c
+++ b/src/rps/test_rps.c
@@ -1958,7 +1958,7 @@ static void compute_probabilities (uint32_t peer_idx)
 {
   //double probs[num_peers] = { 0 };
   double probs[num_peers];
-  size_t probs_as_str_size = (num_peers * 6 + 1) * sizeof (char);
+  size_t probs_as_str_size = (num_peers * 10 + 1) * sizeof (char);
   char *probs_as_str = GNUNET_malloc (probs_as_str_size);
   char *probs_as_str_cpy;
   uint32_t i;
@@ -1998,6 +1998,10 @@ static void compute_probabilities (uint32_t peer_idx)
                  peer_idx,
                  i,
                  prob_push);
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                 "\t\tposs choices from view: %f, containing i: %f\n",
+                 binom (view_size, 0.45 * view_size),
+                 binom (0.45 * view_size, 1));
     } else {
       prob_push = 0;
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -2013,7 +2017,9 @@ static void compute_probabilities (uint32_t peer_idx)
        binom (view_size - cont_views, 0.45 * view_size));
     if (0 != number_of_being_in_pull_events)
     {
-      prob_pull = 1.0 / number_of_being_in_pull_events;
+      prob_pull = number_of_being_in_pull_events
+        /
+        (1.0 * binom (view_size, 0.45 * view_size));
     } else
     {
       prob_pull = 0;
@@ -2062,7 +2068,7 @@ static void compute_probabilities (uint32_t peer_idx)
     probs_as_str_cpy = GNUNET_strndup (probs_as_str, probs_as_str_size);
     tmp = GNUNET_snprintf (probs_as_str,
                            probs_as_str_size,
-                           "%s %3.2f", probs_as_str_cpy, probs[i]);
+                           "%s %7.6f", probs_as_str_cpy, probs[i]);
     GNUNET_free (probs_as_str_cpy);
     GNUNET_assert (0 <= tmp);
   }

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



reply via email to

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