diff options
author | Julius Bünger <buenger@mytum.de> | 2019-04-12 16:35:32 +0200 |
---|---|---|
committer | Julius Bünger <buenger@mytum.de> | 2019-04-18 01:09:53 +0200 |
commit | 89ab4a8ab5c8bcff2c5744b28499c468229ce119 (patch) | |
tree | 9baead9ac264260248790fea0f211e9e922c47ba /src/rps | |
parent | c29a8124f885f28f287e91ce7a0dabcdd6b17d50 (diff) | |
download | gnunet-89ab4a8ab5c8bcff2c5744b28499c468229ce119.tar.gz gnunet-89ab4a8ab5c8bcff2c5744b28499c468229ce119.zip |
RPS profiler: Keep cache of probabilities per peer
Diffstat (limited to 'src/rps')
-rw-r--r-- | src/rps/gnunet-rps-profiler.c | 20 |
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/"); |