summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJulius Bünger <buenger@mytum.de>2019-04-12 16:35:32 +0200
committerJulius Bünger <buenger@mytum.de>2019-04-18 01:09:53 +0200
commit89ab4a8ab5c8bcff2c5744b28499c468229ce119 (patch)
tree9baead9ac264260248790fea0f211e9e922c47ba /src
parentc29a8124f885f28f287e91ce7a0dabcdd6b17d50 (diff)
RPS profiler: Keep cache of probabilities per peer
Diffstat (limited to 'src')
-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
* @brief Handle for the statistics get request
*/
struct GNUNET_STATISTICS_GetHandle *h_stat_get[STAT_TYPE_MAX];
+
+ /**
+ * @brief Keep the probabilities in cache for computing the probabilities
+ * with respect to history.
+ */
+ double *eval_probs_cache;
};
/**
@@ -816,12 +822,6 @@ struct SingleTestRun
* of the run
*/
uint32_t stat_collect_flags;
-
- /**
- * @brief Keep the probabilities in cache for computing the probabilities
- * with respect to history.
- */
- double *eval_probs_cache;
} cur_test_run;
/**
@@ -1192,7 +1192,6 @@ post_test_op (void *cls)
shutdown_task = NULL;
GNUNET_SCHEDULER_shutdown ();
}
- GNUNET_free (cur_test_run.eval_probs_cache);
}
@@ -2329,8 +2328,8 @@ static void compute_probabilities (uint32_t peer_idx)
i,
number_of_being_in_pull_events);
- probs_hist[i] = 0.9 * cur_test_run.eval_probs_cache[i] + probs[i];
- cur_test_run.eval_probs_cache[i] = probs_hist[i];
+ probs_hist[i] = 0.9 * rps_peers[peer_idx].eval_probs_cache[i] + probs[i];
+ rps_peers[peer_idx].eval_probs_cache[i] = probs_hist[i];
sum_non_zero_prob += probs[i];
sum_non_zero_prob_hist += probs_hist[i];
@@ -2812,6 +2811,7 @@ post_profiler (struct RPSPeer *rps_peer)
rps_peer->index);
}
}
+ GNUNET_free (rps_peer->eval_probs_cache);
}
@@ -3000,8 +3000,6 @@ run (void *cls,
BIT(STAT_TYPE_PEERS_IN_VIEW) |
BIT(STAT_TYPE_VIEW_SIZE_AIM);
cur_test_run.have_collect_view = COLLECT_VIEW;
- cur_test_run.eval_probs_cache = GNUNET_new_array (num_peers, double);
- memset (&cur_test_run.eval_probs_cache, num_peers * sizeof (double), 0);
/* 'Clean' directory */
(void) GNUNET_DISK_directory_remove ("/tmp/rps/");