aboutsummaryrefslogtreecommitdiff
path: root/src/rps/test_rps.c
diff options
context:
space:
mode:
authorJulius Bünger <buenger@mytum.de>2018-04-11 10:25:42 +0200
committerJulius Bünger <buenger@mytum.de>2018-04-11 10:26:13 +0200
commit9e0e804cdf11b342a067516ac8d5527c2a774284 (patch)
tree06097b37b30625badedc09c4c43463444a4e9cf5 /src/rps/test_rps.c
parentee35363d3dc4888592d29a205c7036451965250d (diff)
downloadgnunet-9e0e804cdf11b342a067516ac8d5527c2a774284.tar.gz
gnunet-9e0e804cdf11b342a067516ac8d5527c2a774284.zip
rps profiler: logging
Diffstat (limited to 'src/rps/test_rps.c')
-rw-r--r--src/rps/test_rps.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/rps/test_rps.c b/src/rps/test_rps.c
index 03524eaeb..9905e07ab 100644
--- a/src/rps/test_rps.c
+++ b/src/rps/test_rps.c
@@ -1917,6 +1917,9 @@ static uint32_t get_idx_of_pid (const struct GNUNET_PeerIdentity *pid)
1917 } 1917 }
1918 } 1918 }
1919 //return 0; /* Should not happen - make compiler happy */ 1919 //return 0; /* Should not happen - make compiler happy */
1920 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1921 "No known _PeerIdentity %s!\n",
1922 GNUNET_i2s_full (pid));
1920 GNUNET_assert (0); 1923 GNUNET_assert (0);
1921} 1924}
1922 1925
@@ -1967,10 +1970,16 @@ static void compute_probabilities (uint32_t peer_idx)
1967 int tmp; 1970 int tmp;
1968 uint32_t count_non_zero_prob = 0; 1971 uint32_t count_non_zero_prob = 0;
1969 1972
1973 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1974 "Computing probabilities for peer %" PRIu32 "\n", peer_idx);
1970 /* Firstly without knowledge of old views */ 1975 /* Firstly without knowledge of old views */
1971 for (i = 0; i < num_peers; i++) 1976 for (i = 0; i < num_peers; i++)
1972 { 1977 {
1978 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1979 "\tfor peer %" PRIu32 ":\n", i);
1973 view_size = rps_peers[i].cur_view_count; 1980 view_size = rps_peers[i].cur_view_count;
1981 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1982 "\t\tview_size: %" PRIu32 "\n", view_size);
1974 /* For peer i the probability of being sampled is 1983 /* For peer i the probability of being sampled is
1975 * evenly distributed among all possibly observed peers. */ 1984 * evenly distributed among all possibly observed peers. */
1976 /* We could have observed a peer in three cases: 1985 /* We could have observed a peer in three cases:
@@ -2010,6 +2019,14 @@ static void compute_probabilities (uint32_t peer_idx)
2010 prob_pull = 0; 2019 prob_pull = 0;
2011 } 2020 }
2012 probs[i] = prob_push + prob_pull - (prob_push * prob_pull); 2021 probs[i] = prob_push + prob_pull - (prob_push * prob_pull);
2022 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2023 "\t\t%" PRIu32 " has %" PRIu32 " of %" PRIu32
2024 " peers in its view who know %" PRIu32 " prob: %f\n",
2025 peer_idx,
2026 cont_views,
2027 view_size,
2028 i,
2029 prob_pull);
2013 2030
2014 if (0 != probs[i]) count_non_zero_prob++; 2031 if (0 != probs[i]) count_non_zero_prob++;
2015 } 2032 }