aboutsummaryrefslogtreecommitdiff
path: root/src/rps/gnunet-rps-profiler.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/rps/gnunet-rps-profiler.c')
-rw-r--r--src/rps/gnunet-rps-profiler.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/rps/gnunet-rps-profiler.c b/src/rps/gnunet-rps-profiler.c
index 0138346e4..bd68b905b 100644
--- a/src/rps/gnunet-rps-profiler.c
+++ b/src/rps/gnunet-rps-profiler.c
@@ -588,6 +588,12 @@ struct RPSPeer
588 * @brief Handle for the statistics get request 588 * @brief Handle for the statistics get request
589 */ 589 */
590 struct GNUNET_STATISTICS_GetHandle *h_stat_get[STAT_TYPE_MAX]; 590 struct GNUNET_STATISTICS_GetHandle *h_stat_get[STAT_TYPE_MAX];
591
592 /**
593 * @brief Keep the probabilities in cache for computing the probabilities
594 * with respect to history.
595 */
596 double *eval_probs_cache;
591}; 597};
592 598
593/** 599/**
@@ -816,12 +822,6 @@ struct SingleTestRun
816 * of the run 822 * of the run
817 */ 823 */
818 uint32_t stat_collect_flags; 824 uint32_t stat_collect_flags;
819
820 /**
821 * @brief Keep the probabilities in cache for computing the probabilities
822 * with respect to history.
823 */
824 double *eval_probs_cache;
825} cur_test_run; 825} cur_test_run;
826 826
827/** 827/**
@@ -1192,7 +1192,6 @@ post_test_op (void *cls)
1192 shutdown_task = NULL; 1192 shutdown_task = NULL;
1193 GNUNET_SCHEDULER_shutdown (); 1193 GNUNET_SCHEDULER_shutdown ();
1194 } 1194 }
1195 GNUNET_free (cur_test_run.eval_probs_cache);
1196} 1195}
1197 1196
1198 1197
@@ -2329,8 +2328,8 @@ static void compute_probabilities (uint32_t peer_idx)
2329 i, 2328 i,
2330 number_of_being_in_pull_events); 2329 number_of_being_in_pull_events);
2331 2330
2332 probs_hist[i] = 0.9 * cur_test_run.eval_probs_cache[i] + probs[i]; 2331 probs_hist[i] = 0.9 * rps_peers[peer_idx].eval_probs_cache[i] + probs[i];
2333 cur_test_run.eval_probs_cache[i] = probs_hist[i]; 2332 rps_peers[peer_idx].eval_probs_cache[i] = probs_hist[i];
2334 2333
2335 sum_non_zero_prob += probs[i]; 2334 sum_non_zero_prob += probs[i];
2336 sum_non_zero_prob_hist += probs_hist[i]; 2335 sum_non_zero_prob_hist += probs_hist[i];
@@ -2812,6 +2811,7 @@ post_profiler (struct RPSPeer *rps_peer)
2812 rps_peer->index); 2811 rps_peer->index);
2813 } 2812 }
2814 } 2813 }
2814 GNUNET_free (rps_peer->eval_probs_cache);
2815} 2815}
2816 2816
2817 2817
@@ -3000,8 +3000,6 @@ run (void *cls,
3000 BIT(STAT_TYPE_PEERS_IN_VIEW) | 3000 BIT(STAT_TYPE_PEERS_IN_VIEW) |
3001 BIT(STAT_TYPE_VIEW_SIZE_AIM); 3001 BIT(STAT_TYPE_VIEW_SIZE_AIM);
3002 cur_test_run.have_collect_view = COLLECT_VIEW; 3002 cur_test_run.have_collect_view = COLLECT_VIEW;
3003 cur_test_run.eval_probs_cache = GNUNET_new_array (num_peers, double);
3004 memset (&cur_test_run.eval_probs_cache, num_peers * sizeof (double), 0);
3005 3003
3006 /* 'Clean' directory */ 3004 /* 'Clean' directory */
3007 (void) GNUNET_DISK_directory_remove ("/tmp/rps/"); 3005 (void) GNUNET_DISK_directory_remove ("/tmp/rps/");