diff options
author | Florian Dold <florian.dold@gmail.com> | 2017-02-28 02:14:27 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2017-02-28 12:58:47 +0100 |
commit | ebb8d4e79c9ea21befad74973da051fa09efb0d0 (patch) | |
tree | 24765a56f0cce23b1e337567ba09c03a20ba079d /src/consensus/gnunet-consensus-profiler.c | |
parent | cb130cc9dfc179e3b6cb9f19a7b559106efa3b33 (diff) | |
download | gnunet-ebb8d4e79c9ea21befad74973da051fa09efb0d0.tar.gz gnunet-ebb8d4e79c9ea21befad74973da051fa09efb0d0.zip |
consensus: slack-a2a evilness mode and static replication in profiler
Diffstat (limited to 'src/consensus/gnunet-consensus-profiler.c')
-rw-r--r-- | src/consensus/gnunet-consensus-profiler.c | 52 |
1 files changed, 38 insertions, 14 deletions
diff --git a/src/consensus/gnunet-consensus-profiler.c b/src/consensus/gnunet-consensus-profiler.c index 290263d95..65542f4cd 100644 --- a/src/consensus/gnunet-consensus-profiler.c +++ b/src/consensus/gnunet-consensus-profiler.c | |||
@@ -55,6 +55,8 @@ static struct GNUNET_HashCode session_id; | |||
55 | 55 | ||
56 | static unsigned int peers_done = 0; | 56 | static unsigned int peers_done = 0; |
57 | 57 | ||
58 | static int dist_static; | ||
59 | |||
58 | static unsigned *results_for_peer; | 60 | static unsigned *results_for_peer; |
59 | 61 | ||
60 | /** | 62 | /** |
@@ -217,26 +219,45 @@ do_consensus () | |||
217 | { | 219 | { |
218 | int unique_indices[replication]; | 220 | int unique_indices[replication]; |
219 | unsigned int i; | 221 | unsigned int i; |
222 | unsigned int j; | ||
223 | struct GNUNET_HashCode val; | ||
224 | struct GNUNET_SET_Element element; | ||
220 | 225 | ||
221 | for (i = 0; i < num_values; i++) | 226 | if (dist_static) |
222 | { | 227 | { |
223 | unsigned int j; | 228 | for (i = 0; i < num_values; i++) |
224 | struct GNUNET_HashCode val; | 229 | { |
225 | struct GNUNET_SET_Element element; | ||
226 | 230 | ||
227 | generate_indices (unique_indices); | 231 | GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK, &val); |
228 | GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK, &val); | ||
229 | 232 | ||
230 | element.data = &val; | 233 | element.data = &val; |
231 | element.size = sizeof (val); | 234 | element.size = sizeof (val); |
232 | for (j = 0; j < replication; j++) | 235 | for (j = 0; j < replication; j++) |
236 | { | ||
237 | GNUNET_CONSENSUS_insert (consensus_handles[j], | ||
238 | &element, | ||
239 | NULL, NULL); | ||
240 | } | ||
241 | } | ||
242 | } | ||
243 | else | ||
244 | { | ||
245 | for (i = 0; i < num_values; i++) | ||
233 | { | 246 | { |
234 | int cid; | 247 | generate_indices (unique_indices); |
248 | GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK, &val); | ||
235 | 249 | ||
236 | cid = unique_indices[j]; | 250 | element.data = &val; |
237 | GNUNET_CONSENSUS_insert (consensus_handles[cid], | 251 | element.size = sizeof (val); |
238 | &element, | 252 | for (j = 0; j < replication; j++) |
239 | NULL, NULL); | 253 | { |
254 | int cid; | ||
255 | |||
256 | cid = unique_indices[j]; | ||
257 | GNUNET_CONSENSUS_insert (consensus_handles[cid], | ||
258 | &element, | ||
259 | NULL, NULL); | ||
260 | } | ||
240 | } | 261 | } |
241 | } | 262 | } |
242 | 263 | ||
@@ -513,6 +534,9 @@ main (int argc, char **argv) | |||
513 | { 's', "statistics", NULL, | 534 | { 's', "statistics", NULL, |
514 | gettext_noop ("write statistics to file"), | 535 | gettext_noop ("write statistics to file"), |
515 | GNUNET_YES, &GNUNET_GETOPT_set_filename, &statistics_filename }, | 536 | GNUNET_YES, &GNUNET_GETOPT_set_filename, &statistics_filename }, |
537 | { 'S', "dist-static", NULL, | ||
538 | gettext_noop ("distribute elements to a static subset of good peers"), | ||
539 | GNUNET_YES, &GNUNET_GETOPT_set_one, &dist_static }, | ||
516 | { 'V', "verbose", NULL, | 540 | { 'V', "verbose", NULL, |
517 | gettext_noop ("be more verbose (print received values)"), | 541 | gettext_noop ("be more verbose (print received values)"), |
518 | GNUNET_NO, &GNUNET_GETOPT_set_one, &verbose }, | 542 | GNUNET_NO, &GNUNET_GETOPT_set_one, &verbose }, |