aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/rps/gnunet-rps-profiler.c19
-rw-r--r--src/rps/test_rps.c12
2 files changed, 15 insertions, 16 deletions
diff --git a/src/rps/gnunet-rps-profiler.c b/src/rps/gnunet-rps-profiler.c
index 08d1d2d34..392a3c18f 100644
--- a/src/rps/gnunet-rps-profiler.c
+++ b/src/rps/gnunet-rps-profiler.c
@@ -485,7 +485,7 @@ struct RPSPeer
485 /** 485 /**
486 * Index of the peer. 486 * Index of the peer.
487 */ 487 */
488 unsigned int index; 488 uint32_t index;
489 489
490 /** 490 /**
491 * Handle for RPS connect operation. 491 * Handle for RPS connect operation.
@@ -1683,14 +1683,14 @@ mal_pre (struct RPSPeer *rps_peer, struct GNUNET_RPS_Handle *h)
1683static void 1683static void
1684mal_cb (struct RPSPeer *rps_peer) 1684mal_cb (struct RPSPeer *rps_peer)
1685{ 1685{
1686 uint32_t num_mal_peers;
1687
1688 if ((GNUNET_YES == in_shutdown) || (GNUNET_YES == post_test)) 1686 if ((GNUNET_YES == in_shutdown) || (GNUNET_YES == post_test))
1689 { 1687 {
1690 return; 1688 return;
1691 } 1689 }
1692 1690
1693 #if ENABLE_MALICIOUS 1691 #if ENABLE_MALICIOUS
1692 uint32_t num_mal_peers;
1693
1694 GNUNET_assert ((1 >= portion) && 1694 GNUNET_assert ((1 >= portion) &&
1695 (0 < portion)); 1695 (0 < portion));
1696 num_mal_peers = round (portion * num_peers); 1696 num_mal_peers = round (portion * num_peers);
@@ -2080,7 +2080,6 @@ profiler_reply_handle_info (void *cls,
2080 char *file_name_dh = file_name_dh_buf; 2080 char *file_name_dh = file_name_dh_buf;
2081 char *file_name_dhr = file_name_dhr_buf; 2081 char *file_name_dhr = file_name_dhr_buf;
2082 char *file_name_dhru = file_name_dhru_buf; 2082 char *file_name_dhru = file_name_dhru_buf;
2083 unsigned int i;
2084 struct PendingReply *pending_rep = (struct PendingReply *) cls; 2083 struct PendingReply *pending_rep = (struct PendingReply *) cls;
2085 2084
2086 pending_rep->req_handle = NULL; 2085 pending_rep->req_handle = NULL;
@@ -2106,7 +2105,7 @@ profiler_reply_handle_info (void *cls,
2106 " %s\n", 2105 " %s\n",
2107 GNUNET_i2s (recv_peer)); 2106 GNUNET_i2s (recv_peer));
2108 tofile (file_name, 2107 tofile (file_name,
2109 "%s %d %" PRIu32 " \n", 2108 "%s %f %" PRIu32 " \n",
2110 GNUNET_i2s_full (recv_peer), 2109 GNUNET_i2s_full (recv_peer),
2111 probability, 2110 probability,
2112 num_observed); 2111 num_observed);
@@ -2602,7 +2601,7 @@ view_update_cb (void *cls,
2602 "View was updated (%" PRIu64 ")\n", view_size); 2601 "View was updated (%" PRIu64 ")\n", view_size);
2603 struct RPSPeer *rps_peer = (struct RPSPeer *) cls; 2602 struct RPSPeer *rps_peer = (struct RPSPeer *) cls;
2604 to_file ("/tmp/rps/view_sizes.txt", 2603 to_file ("/tmp/rps/view_sizes.txt",
2605 "%" PRIu64 " %" PRIu32 "", 2604 "%" PRIu32 " %" PRIu64 "",
2606 rps_peer->index, 2605 rps_peer->index,
2607 view_size); 2606 view_size);
2608 for (uint64_t i = 0; i < view_size; i++) 2607 for (uint64_t i = 0; i < view_size; i++)
@@ -2618,14 +2617,14 @@ view_update_cb (void *cls,
2618 peers, 2617 peers,
2619 view_size * sizeof(struct GNUNET_PeerIdentity)); 2618 view_size * sizeof(struct GNUNET_PeerIdentity));
2620 to_file ("/tmp/rps/count_in_views.txt", 2619 to_file ("/tmp/rps/count_in_views.txt",
2621 "%" PRIu64 " %" PRIu32 "", 2620 "%" PRIu32 " %" PRIu32 "",
2622 rps_peer->index, 2621 rps_peer->index,
2623 count_peer_in_views_2 (rps_peer->index)); 2622 count_peer_in_views_2 (rps_peer->index));
2624 cumulated_view_sizes (); 2623 cumulated_view_sizes ();
2625 if (0 != view_size) 2624 if (0 != view_size)
2626 { 2625 {
2627 to_file ("/tmp/rps/repr.txt", 2626 to_file ("/tmp/rps/repr.txt",
2628 "%" PRIu64 /* index */ 2627 "%" PRIu32 /* index */
2629 " %" PRIu32 /* occurrence in views */ 2628 " %" PRIu32 /* occurrence in views */
2630 " %" PRIu32 /* view sizes */ 2629 " %" PRIu32 /* view sizes */
2631 " %f" /* fraction of repr in views */ 2630 " %f" /* fraction of repr in views */
@@ -2901,7 +2900,7 @@ post_profiler (struct RPSPeer *rps_peer)
2901 stat_cls->rps_peer = rps_peer; 2900 stat_cls->rps_peer = rps_peer;
2902 stat_cls->stat_type = stat_type; 2901 stat_cls->stat_type = stat_type;
2903 rps_peer->file_name_stats = 2902 rps_peer->file_name_stats =
2904 store_prefix_file_name (rps_peer->peer_id, "stats"); 2903 store_prefix_file_name (rps_peer->index, "stats");
2905 rps_peer->h_stat_get[stat_type] = 2904 rps_peer->h_stat_get[stat_type] =
2906 GNUNET_STATISTICS_get (rps_peer->stats_h, 2905 GNUNET_STATISTICS_get (rps_peer->stats_h,
2907 "rps", 2906 "rps",
@@ -3150,7 +3149,7 @@ run (void *cls,
3150 timeout.rel_value_us / 1000000); 3149 timeout.rel_value_us / 1000000);
3151 3150
3152 /* Compute number of bits for representing largest peer id */ 3151 /* Compute number of bits for representing largest peer id */
3153 for (bits_needed = 1; (1 << bits_needed) < num_peers; bits_needed++) 3152 for (bits_needed = 1; (uint32_t) (1 << bits_needed) < num_peers; bits_needed++)
3154 ; 3153 ;
3155 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 3154 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
3156 "Need %u bits to represent %" PRIu32 " peers\n", 3155 "Need %u bits to represent %" PRIu32 " peers\n",
diff --git a/src/rps/test_rps.c b/src/rps/test_rps.c
index a7dc3aa00..de09b423f 100644
--- a/src/rps/test_rps.c
+++ b/src/rps/test_rps.c
@@ -180,7 +180,7 @@ struct RPSPeer
180 /** 180 /**
181 * Index of the peer. 181 * Index of the peer.
182 */ 182 */
183 unsigned int index; 183 uint32_t index;
184 184
185 /** 185 /**
186 * Handle for RPS connect operation. 186 * Handle for RPS connect operation.
@@ -2380,10 +2380,10 @@ view_update_cb (void *cls,
2380 "View was updated (%" PRIu64 ")\n", view_size); 2380 "View was updated (%" PRIu64 ")\n", view_size);
2381 struct RPSPeer *rps_peer = (struct RPSPeer *) cls; 2381 struct RPSPeer *rps_peer = (struct RPSPeer *) cls;
2382 to_file ("/tmp/rps/view_sizes.txt", 2382 to_file ("/tmp/rps/view_sizes.txt",
2383 "%" PRIu64 " %" PRIu32 "", 2383 "%" PRIu32 " %" PRIu64 "",
2384 rps_peer->index, 2384 rps_peer->index,
2385 view_size); 2385 view_size);
2386 for (int i = 0; i < view_size; i++) 2386 for (uint64_t i = 0; i < view_size; i++)
2387 { 2387 {
2388 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2388 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2389 "\t%s\n", GNUNET_i2s (&peers[i])); 2389 "\t%s\n", GNUNET_i2s (&peers[i]));
@@ -2396,14 +2396,14 @@ view_update_cb (void *cls,
2396 peers, 2396 peers,
2397 view_size * sizeof(struct GNUNET_PeerIdentity)); 2397 view_size * sizeof(struct GNUNET_PeerIdentity));
2398 to_file ("/tmp/rps/count_in_views.txt", 2398 to_file ("/tmp/rps/count_in_views.txt",
2399 "%" PRIu64 " %" PRIu32 "", 2399 "%" PRIu32 " %" PRIu32 "",
2400 rps_peer->index, 2400 rps_peer->index,
2401 count_peer_in_views_2 (rps_peer->index)); 2401 count_peer_in_views_2 (rps_peer->index));
2402 cumulated_view_sizes (); 2402 cumulated_view_sizes ();
2403 if (0 != view_size) 2403 if (0 != view_size)
2404 { 2404 {
2405 to_file ("/tmp/rps/repr.txt", 2405 to_file ("/tmp/rps/repr.txt",
2406 "%" PRIu64 /* index */ 2406 "%" PRIu32 /* index */
2407 " %" PRIu32 /* occurrence in views */ 2407 " %" PRIu32 /* occurrence in views */
2408 " %" PRIu32 /* view sizes */ 2408 " %" PRIu32 /* view sizes */
2409 " %f" /* fraction of repr in views */ 2409 " %f" /* fraction of repr in views */
@@ -2428,7 +2428,7 @@ static void
2428pre_profiler (struct RPSPeer *rps_peer, struct GNUNET_RPS_Handle *h) 2428pre_profiler (struct RPSPeer *rps_peer, struct GNUNET_RPS_Handle *h)
2429{ 2429{
2430 rps_peer->file_name_probs = 2430 rps_peer->file_name_probs =
2431 store_prefix_file_name (rps_peer->peer_id, "probs"); 2431 store_prefix_file_name (rps_peer->index, "probs");
2432 GNUNET_RPS_view_request (h, 0, view_update_cb, rps_peer); 2432 GNUNET_RPS_view_request (h, 0, view_update_cb, rps_peer);
2433} 2433}
2434 2434