aboutsummaryrefslogtreecommitdiff
path: root/src/consensus/gnunet-consensus-profiler.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/consensus/gnunet-consensus-profiler.c')
-rw-r--r--src/consensus/gnunet-consensus-profiler.c536
1 files changed, 268 insertions, 268 deletions
diff --git a/src/consensus/gnunet-consensus-profiler.c b/src/consensus/gnunet-consensus-profiler.c
index e088904aa..9feee87cd 100644
--- a/src/consensus/gnunet-consensus-profiler.c
+++ b/src/consensus/gnunet-consensus-profiler.c
@@ -11,7 +11,7 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 17
@@ -92,26 +92,26 @@ static struct GNUNET_TIME_Absolute deadline;
92 * @param event information about the event 92 * @param event information about the event
93 */ 93 */
94static void 94static void
95controller_cb (void *cls, 95controller_cb(void *cls,
96 const struct GNUNET_TESTBED_EventInformation *event) 96 const struct GNUNET_TESTBED_EventInformation *event)
97{ 97{
98 GNUNET_assert (0); 98 GNUNET_assert(0);
99} 99}
100 100
101 101
102static void 102static void
103statistics_done_cb (void *cls, 103statistics_done_cb(void *cls,
104 struct 104 struct
105 GNUNET_TESTBED_Operation 105 GNUNET_TESTBED_Operation
106 *op, 106 *op,
107 const char *emsg) 107 const char *emsg)
108{ 108{
109 GNUNET_assert (NULL == emsg); 109 GNUNET_assert(NULL == emsg);
110 GNUNET_TESTBED_operation_done (op); 110 GNUNET_TESTBED_operation_done(op);
111 if (NULL != statistics_file) 111 if (NULL != statistics_file)
112 fclose (statistics_file); 112 fclose(statistics_file);
113 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "got statistics, shutting down\n"); 113 GNUNET_log(GNUNET_ERROR_TYPE_INFO, "got statistics, shutting down\n");
114 GNUNET_SCHEDULER_shutdown (); 114 GNUNET_SCHEDULER_shutdown();
115} 115}
116 116
117 117
@@ -127,47 +127,47 @@ statistics_done_cb (void *cls,
127 * @return #GNUNET_OK to continue, #GNUNET_SYSERR to abort iteration 127 * @return #GNUNET_OK to continue, #GNUNET_SYSERR to abort iteration
128 */ 128 */
129static int 129static int
130statistics_cb (void *cls, 130statistics_cb(void *cls,
131 const struct GNUNET_TESTBED_Peer *peer, 131 const struct GNUNET_TESTBED_Peer *peer,
132 const char *subsystem, 132 const char *subsystem,
133 const char *name, 133 const char *name,
134 uint64_t value, 134 uint64_t value,
135 int is_persistent) 135 int is_persistent)
136{ 136{
137 if (NULL != statistics_file) 137 if (NULL != statistics_file)
138 { 138 {
139 fprintf (statistics_file, "P%u\t%s\t%s\t%lu\n", GNUNET_TESTBED_get_index (peer), subsystem, name, (unsigned long) value); 139 fprintf(statistics_file, "P%u\t%s\t%s\t%lu\n", GNUNET_TESTBED_get_index(peer), subsystem, name, (unsigned long)value);
140 } 140 }
141 return GNUNET_OK; 141 return GNUNET_OK;
142} 142}
143 143
144 144
145static void 145static void
146destroy (void *cls) 146destroy(void *cls)
147{ 147{
148 struct GNUNET_CONSENSUS_Handle *consensus = cls; 148 struct GNUNET_CONSENSUS_Handle *consensus = cls;
149 149
150 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 150 GNUNET_log(GNUNET_ERROR_TYPE_INFO,
151 "destroying consensus\n"); 151 "destroying consensus\n");
152 GNUNET_CONSENSUS_destroy (consensus); 152 GNUNET_CONSENSUS_destroy(consensus);
153 peers_done++; 153 peers_done++;
154 if (peers_done == num_peers) 154 if (peers_done == num_peers)
155 { 155 {
156 unsigned int i; 156 unsigned int i;
157 for (i = 0; i < num_peers; i++) 157 for (i = 0; i < num_peers; i++)
158 GNUNET_TESTBED_operation_done (testbed_operations[i]); 158 GNUNET_TESTBED_operation_done(testbed_operations[i]);
159 for (i = 0; i < num_peers; i++) 159 for (i = 0; i < num_peers; i++)
160 printf ("P%u got %u of %u elements\n", 160 printf("P%u got %u of %u elements\n",
161 i, 161 i,
162 results_for_peer[i], 162 results_for_peer[i],
163 num_values); 163 num_values);
164 if (NULL != statistics_filename) 164 if (NULL != statistics_filename)
165 statistics_file = fopen (statistics_filename, "w"); 165 statistics_file = fopen(statistics_filename, "w");
166 GNUNET_TESTBED_get_statistics (num_peers, peers, NULL, NULL, 166 GNUNET_TESTBED_get_statistics(num_peers, peers, NULL, NULL,
167 statistics_cb, 167 statistics_cb,
168 statistics_done_cb, 168 statistics_done_cb,
169 NULL); 169 NULL);
170 } 170 }
171} 171}
172 172
173 173
@@ -179,43 +179,44 @@ destroy (void *cls)
179 * #GNUNET_NO if not 179 * #GNUNET_NO if not
180 */ 180 */
181static void 181static void
182conclude_cb (void *cls) 182conclude_cb(void *cls)
183{ 183{
184 struct GNUNET_CONSENSUS_Handle **chp = cls; 184 struct GNUNET_CONSENSUS_Handle **chp = cls;
185 185
186 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 186 GNUNET_log(GNUNET_ERROR_TYPE_INFO,
187 "consensus %d done\n", 187 "consensus %d done\n",
188 (int) (chp - consensus_handles)); 188 (int)(chp - consensus_handles));
189 GNUNET_SCHEDULER_add_now (destroy, *chp); 189 GNUNET_SCHEDULER_add_now(destroy, *chp);
190} 190}
191 191
192 192
193static void 193static void
194generate_indices (int *indices) 194generate_indices(int *indices)
195{ 195{
196 int j; 196 int j;
197
197 j = 0; 198 j = 0;
198 while (j < replication) 199 while (j < replication)
199 { 200 {
200 int n; 201 int n;
201 int k; 202 int k;
202 int repeat; 203 int repeat;
203 n = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, num_peers); 204 n = GNUNET_CRYPTO_random_u32(GNUNET_CRYPTO_QUALITY_WEAK, num_peers);
204 repeat = GNUNET_NO; 205 repeat = GNUNET_NO;
205 for (k = 0; k < j; k++) 206 for (k = 0; k < j; k++)
206 if (indices[k] == n) 207 if (indices[k] == n)
207 { 208 {
208 repeat = GNUNET_YES; 209 repeat = GNUNET_YES;
209 break; 210 break;
210 } 211 }
211 if (GNUNET_NO == repeat) 212 if (GNUNET_NO == repeat)
212 indices[j++] = n; 213 indices[j++] = n;
213 } 214 }
214} 215}
215 216
216 217
217static void 218static void
218do_consensus () 219do_consensus()
219{ 220{
220 int unique_indices[replication]; 221 int unique_indices[replication];
221 unsigned int i; 222 unsigned int i;
@@ -224,49 +225,48 @@ do_consensus ()
224 struct GNUNET_SET_Element element; 225 struct GNUNET_SET_Element element;
225 226
226 if (dist_static) 227 if (dist_static)
227 {
228 for (i = 0; i < num_values; i++)
229 { 228 {
230 229 for (i = 0; i < num_values; i++)
231 GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK, &val); 230 {
232 231 GNUNET_CRYPTO_hash_create_random(GNUNET_CRYPTO_QUALITY_WEAK, &val);
233 element.data = &val; 232
234 element.size = sizeof (val); 233 element.data = &val;
235 for (j = 0; j < replication; j++) 234 element.size = sizeof(val);
236 { 235 for (j = 0; j < replication; j++)
237 GNUNET_CONSENSUS_insert (consensus_handles[j], 236 {
238 &element, 237 GNUNET_CONSENSUS_insert(consensus_handles[j],
239 NULL, NULL); 238 &element,
240 } 239 NULL, NULL);
240 }
241 }
241 } 242 }
242 }
243 else 243 else
244 {
245 for (i = 0; i < num_values; i++)
246 { 244 {
247 generate_indices (unique_indices); 245 for (i = 0; i < num_values; i++)
248 GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK, &val); 246 {
249 247 generate_indices(unique_indices);
250 element.data = &val; 248 GNUNET_CRYPTO_hash_create_random(GNUNET_CRYPTO_QUALITY_WEAK, &val);
251 element.size = sizeof (val); 249
252 for (j = 0; j < replication; j++) 250 element.data = &val;
253 { 251 element.size = sizeof(val);
254 int cid; 252 for (j = 0; j < replication; j++)
255 253 {
256 cid = unique_indices[j]; 254 int cid;
257 GNUNET_CONSENSUS_insert (consensus_handles[cid], 255
258 &element, 256 cid = unique_indices[j];
259 NULL, NULL); 257 GNUNET_CONSENSUS_insert(consensus_handles[cid],
260 } 258 &element,
259 NULL, NULL);
260 }
261 }
261 } 262 }
262 }
263 263
264 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 264 GNUNET_log(GNUNET_ERROR_TYPE_INFO,
265 "all elements inserted, calling conclude\n"); 265 "all elements inserted, calling conclude\n");
266 266
267 for (i = 0; i < num_peers; i++) 267 for (i = 0; i < num_peers; i++)
268 GNUNET_CONSENSUS_conclude (consensus_handles[i], 268 GNUNET_CONSENSUS_conclude(consensus_handles[i],
269 conclude_cb, &consensus_handles[i]); 269 conclude_cb, &consensus_handles[i]);
270} 270}
271 271
272 272
@@ -280,51 +280,50 @@ do_consensus ()
280 * operation has executed successfully. 280 * operation has executed successfully.
281 */ 281 */
282static void 282static void
283connect_complete (void *cls, 283connect_complete(void *cls,
284 struct GNUNET_TESTBED_Operation *op, 284 struct GNUNET_TESTBED_Operation *op,
285 void *ca_result, 285 void *ca_result,
286 const char *emsg) 286 const char *emsg)
287{ 287{
288
289 if (NULL != emsg) 288 if (NULL != emsg)
290 { 289 {
291 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 290 GNUNET_log(GNUNET_ERROR_TYPE_ERROR,
292 "testbed connect emsg: %s\n", 291 "testbed connect emsg: %s\n",
293 emsg); 292 emsg);
294 GNUNET_assert (0); 293 GNUNET_assert(0);
295 } 294 }
296 295
297 num_connected_handles++; 296 num_connected_handles++;
298 297
299 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 298 GNUNET_log(GNUNET_ERROR_TYPE_INFO,
300 "connect complete\n"); 299 "connect complete\n");
301 300
302 if (num_connected_handles == num_peers) 301 if (num_connected_handles == num_peers)
303 { 302 {
304 do_consensus (); 303 do_consensus();
305 } 304 }
306} 305}
307 306
308 307
309static void 308static void
310new_element_cb (void *cls, 309new_element_cb(void *cls,
311 const struct GNUNET_SET_Element *element) 310 const struct GNUNET_SET_Element *element)
312{ 311{
313 struct GNUNET_CONSENSUS_Handle **chp = cls; 312 struct GNUNET_CONSENSUS_Handle **chp = cls;
314 int idx = chp - consensus_handles; 313 int idx = chp - consensus_handles;
315 314
316 GNUNET_assert (NULL != cls); 315 GNUNET_assert(NULL != cls);
317 316
318 results_for_peer[idx]++; 317 results_for_peer[idx]++;
319 318
320 GNUNET_assert (sizeof (struct GNUNET_HashCode) == element->size); 319 GNUNET_assert(sizeof(struct GNUNET_HashCode) == element->size);
321 320
322 if (GNUNET_YES == verbose) 321 if (GNUNET_YES == verbose)
323 { 322 {
324 printf ("P%d received %s\n", 323 printf("P%d received %s\n",
325 idx, 324 idx,
326 GNUNET_h2s ((struct GNUNET_HashCode *) element->data)); 325 GNUNET_h2s((struct GNUNET_HashCode *)element->data));
327 } 326 }
328} 327}
329 328
330 329
@@ -339,23 +338,24 @@ new_element_cb (void *cls,
339 * @return service handle to return in 'op_result', NULL on error 338 * @return service handle to return in 'op_result', NULL on error
340 */ 339 */
341static void * 340static void *
342connect_adapter (void *cls, 341connect_adapter(void *cls,
343 const struct GNUNET_CONFIGURATION_Handle *cfg) 342 const struct GNUNET_CONFIGURATION_Handle *cfg)
344{ 343{
345 struct GNUNET_CONSENSUS_Handle **chp = cls; 344 struct GNUNET_CONSENSUS_Handle **chp = cls;
346 struct GNUNET_CONSENSUS_Handle *consensus; 345 struct GNUNET_CONSENSUS_Handle *consensus;
347 chp = (struct GNUNET_CONSENSUS_Handle **) cls; 346
348 347 chp = (struct GNUNET_CONSENSUS_Handle **)cls;
349 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 348
350 "connect adapter, %d peers\n", 349 GNUNET_log(GNUNET_ERROR_TYPE_INFO,
351 num_peers); 350 "connect adapter, %d peers\n",
352 consensus = GNUNET_CONSENSUS_create (cfg, 351 num_peers);
353 num_peers, peer_ids, 352 consensus = GNUNET_CONSENSUS_create(cfg,
354 &session_id, 353 num_peers, peer_ids,
355 start, 354 &session_id,
356 deadline, 355 start,
357 &new_element_cb, chp); 356 deadline,
358 *chp = (struct GNUNET_CONSENSUS_Handle *) consensus; 357 &new_element_cb, chp);
358 *chp = (struct GNUNET_CONSENSUS_Handle *)consensus;
359 return consensus; 359 return consensus;
360} 360}
361 361
@@ -371,8 +371,8 @@ static void
371disconnect_adapter(void *cls, void *op_result) 371disconnect_adapter(void *cls, void *op_result)
372{ 372{
373 /* FIXME: what to do here? */ 373 /* FIXME: what to do here? */
374 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 374 GNUNET_log(GNUNET_ERROR_TYPE_INFO,
375 "disconnect adapter called\n"); 375 "disconnect adapter called\n");
376} 376}
377 377
378 378
@@ -386,34 +386,34 @@ disconnect_adapter(void *cls, void *op_result)
386 * operation is successfull 386 * operation is successfull
387 */ 387 */
388static void 388static void
389peer_info_cb (void *cb_cls, 389peer_info_cb(void *cb_cls,
390 struct GNUNET_TESTBED_Operation *op, 390 struct GNUNET_TESTBED_Operation *op,
391 const struct GNUNET_TESTBED_PeerInformation *pinfo, 391 const struct GNUNET_TESTBED_PeerInformation *pinfo,
392 const char *emsg) 392 const char *emsg)
393{ 393{
394 struct GNUNET_PeerIdentity *p; 394 struct GNUNET_PeerIdentity *p;
395 int i; 395 int i;
396 396
397 GNUNET_assert (NULL == emsg); 397 GNUNET_assert(NULL == emsg);
398 398
399 p = (struct GNUNET_PeerIdentity *) cb_cls; 399 p = (struct GNUNET_PeerIdentity *)cb_cls;
400 400
401 if (pinfo->pit == GNUNET_TESTBED_PIT_IDENTITY) 401 if (pinfo->pit == GNUNET_TESTBED_PIT_IDENTITY)
402 { 402 {
403 *p = *pinfo->result.id; 403 *p = *pinfo->result.id;
404 num_retrieved_peer_ids++; 404 num_retrieved_peer_ids++;
405 if (num_retrieved_peer_ids == num_peers) 405 if (num_retrieved_peer_ids == num_peers)
406 for (i = 0; i < num_peers; i++) 406 for (i = 0; i < num_peers; i++)
407 testbed_operations[i] = 407 testbed_operations[i] =
408 GNUNET_TESTBED_service_connect (NULL, peers[i], "consensus", connect_complete, NULL, 408 GNUNET_TESTBED_service_connect(NULL, peers[i], "consensus", connect_complete, NULL,
409 connect_adapter, disconnect_adapter, &consensus_handles[i]); 409 connect_adapter, disconnect_adapter, &consensus_handles[i]);
410 } 410 }
411 else 411 else
412 { 412 {
413 GNUNET_assert (0); 413 GNUNET_assert(0);
414 } 414 }
415 415
416 GNUNET_TESTBED_operation_done (op); 416 GNUNET_TESTBED_operation_done(op);
417} 417}
418 418
419 419
@@ -431,144 +431,144 @@ peer_info_cb (void *cb_cls,
431 * failed 431 * failed
432 */ 432 */
433static void 433static void
434test_master (void *cls, 434test_master(void *cls,
435 struct GNUNET_TESTBED_RunHandle *h, 435 struct GNUNET_TESTBED_RunHandle *h,
436 unsigned int num_peers, 436 unsigned int num_peers,
437 struct GNUNET_TESTBED_Peer **started_peers, 437 struct GNUNET_TESTBED_Peer **started_peers,
438 unsigned int links_succeeded, 438 unsigned int links_succeeded,
439 unsigned int links_failed) 439 unsigned int links_failed)
440{ 440{
441 int i; 441 int i;
442 442
443 GNUNET_log_setup ("gnunet-consensus", "INFO", NULL); 443 GNUNET_log_setup("gnunet-consensus", "INFO", NULL);
444 444
445 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "test master\n"); 445 GNUNET_log(GNUNET_ERROR_TYPE_INFO, "test master\n");
446 446
447 peers = started_peers; 447 peers = started_peers;
448 448
449 peer_ids = GNUNET_malloc (num_peers * sizeof (struct GNUNET_PeerIdentity)); 449 peer_ids = GNUNET_malloc(num_peers * sizeof(struct GNUNET_PeerIdentity));
450 450
451 results_for_peer = GNUNET_malloc (num_peers * sizeof (unsigned int)); 451 results_for_peer = GNUNET_malloc(num_peers * sizeof(unsigned int));
452 consensus_handles = GNUNET_malloc (num_peers * sizeof (struct ConsensusHandle *)); 452 consensus_handles = GNUNET_malloc(num_peers * sizeof(struct ConsensusHandle *));
453 testbed_operations = GNUNET_malloc (num_peers * sizeof (struct ConsensusHandle *)); 453 testbed_operations = GNUNET_malloc(num_peers * sizeof(struct ConsensusHandle *));
454 454
455 for (i = 0; i < num_peers; i++) 455 for (i = 0; i < num_peers; i++)
456 GNUNET_TESTBED_peer_get_information (peers[i], 456 GNUNET_TESTBED_peer_get_information(peers[i],
457 GNUNET_TESTBED_PIT_IDENTITY, 457 GNUNET_TESTBED_PIT_IDENTITY,
458 peer_info_cb, 458 peer_info_cb,
459 &peer_ids[i]); 459 &peer_ids[i]);
460} 460}
461 461
462 462
463static void 463static void
464run (void *cls, char *const *args, const char *cfgfile, 464run(void *cls, char *const *args, const char *cfgfile,
465 const struct GNUNET_CONFIGURATION_Handle *cfg) 465 const struct GNUNET_CONFIGURATION_Handle *cfg)
466{ 466{
467 static char *session_str = "gnunet-consensus/test"; 467 static char *session_str = "gnunet-consensus/test";
468 char *topology; 468 char *topology;
469 int topology_cmp_result; 469 int topology_cmp_result;
470 470
471 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (cfg, "testbed", "OVERLAY_TOPOLOGY", &topology)) 471 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string(cfg, "testbed", "OVERLAY_TOPOLOGY", &topology))
472 { 472 {
473 fprintf (stderr, 473 fprintf(stderr,
474 "'OVERLAY_TOPOLOGY' not found in 'testbed' config section, " 474 "'OVERLAY_TOPOLOGY' not found in 'testbed' config section, "
475 "seems like you passed the wrong configuration file\n"); 475 "seems like you passed the wrong configuration file\n");
476 return; 476 return;
477 } 477 }
478 478
479 topology_cmp_result = strcasecmp (topology, "NONE"); 479 topology_cmp_result = strcasecmp(topology, "NONE");
480 GNUNET_free (topology); 480 GNUNET_free(topology);
481 481
482 if (0 == topology_cmp_result) 482 if (0 == topology_cmp_result)
483 { 483 {
484 fprintf (stderr, 484 fprintf(stderr,
485 "'OVERLAY_TOPOLOGY' set to 'NONE', " 485 "'OVERLAY_TOPOLOGY' set to 'NONE', "
486 "seems like you passed the wrong configuration file\n"); 486 "seems like you passed the wrong configuration file\n");
487 return; 487 return;
488 } 488 }
489 489
490 if (num_peers < replication) 490 if (num_peers < replication)
491 { 491 {
492 fprintf (stderr, "k must be <=n\n"); 492 fprintf(stderr, "k must be <=n\n");
493 return; 493 return;
494 } 494 }
495 495
496 start = GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get (), consensus_delay); 496 start = GNUNET_TIME_absolute_add(GNUNET_TIME_absolute_get(), consensus_delay);
497 deadline = GNUNET_TIME_absolute_add (start, conclude_timeout); 497 deadline = GNUNET_TIME_absolute_add(start, conclude_timeout);
498 498
499 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 499 GNUNET_log(GNUNET_ERROR_TYPE_INFO,
500 "running gnunet-consensus\n"); 500 "running gnunet-consensus\n");
501 501
502 GNUNET_CRYPTO_hash (session_str, strlen(session_str), &session_id); 502 GNUNET_CRYPTO_hash(session_str, strlen(session_str), &session_id);
503 503
504 (void) GNUNET_TESTBED_test_run ("gnunet-consensus", 504 (void)GNUNET_TESTBED_test_run("gnunet-consensus",
505 cfgfile, 505 cfgfile,
506 num_peers, 506 num_peers,
507 0, 507 0,
508 controller_cb, 508 controller_cb,
509 NULL, 509 NULL,
510 test_master, 510 test_master,
511 NULL); 511 NULL);
512} 512}
513 513
514 514
515int 515int
516main (int argc, char **argv) 516main(int argc, char **argv)
517{ 517{
518 struct GNUNET_GETOPT_CommandLineOption options[] = { 518 struct GNUNET_GETOPT_CommandLineOption options[] = {
519 519 GNUNET_GETOPT_option_uint('n',
520 GNUNET_GETOPT_option_uint ('n', 520 "num-peers",
521 "num-peers", 521 NULL,
522 NULL, 522 gettext_noop("number of peers in consensus"),
523 gettext_noop ("number of peers in consensus"), 523 &num_peers),
524 &num_peers), 524
525 525 GNUNET_GETOPT_option_uint('k',
526 GNUNET_GETOPT_option_uint ('k', 526 "value-replication",
527 "value-replication", 527 NULL,
528 NULL, 528 gettext_noop("how many peers (random selection without replacement) receive one value?"),
529 gettext_noop ("how many peers (random selection without replacement) receive one value?"), 529 &replication),
530 &replication), 530
531 531 GNUNET_GETOPT_option_uint('x',
532 GNUNET_GETOPT_option_uint ('x', 532 "num-values",
533 "num-values", 533 NULL,
534 NULL, 534 gettext_noop("number of values"),
535 gettext_noop ("number of values"), 535 &num_values),
536 &num_values), 536
537 537 GNUNET_GETOPT_option_relative_time('t',
538 GNUNET_GETOPT_option_relative_time ('t', 538 "timeout",
539 "timeout", 539 NULL,
540 NULL, 540 gettext_noop("consensus timeout"),
541 gettext_noop ("consensus timeout"), 541 &conclude_timeout),
542 &conclude_timeout), 542
543 543
544 544 GNUNET_GETOPT_option_relative_time('d',
545 GNUNET_GETOPT_option_relative_time ('d', 545 "delay",
546 "delay", 546 NULL,
547 NULL, 547 gettext_noop("delay until consensus starts"),
548 gettext_noop ("delay until consensus starts"), 548 &consensus_delay),
549 &consensus_delay), 549
550 550 GNUNET_GETOPT_option_filename('s',
551 GNUNET_GETOPT_option_filename ('s', 551 "statistics",
552 "statistics", 552 "FILENAME",
553 "FILENAME", 553 gettext_noop("write statistics to file"),
554 gettext_noop ("write statistics to file"), 554 &statistics_filename),
555 &statistics_filename), 555
556 556 GNUNET_GETOPT_option_flag('S',
557 GNUNET_GETOPT_option_flag ('S', 557 "dist-static",
558 "dist-static", 558 gettext_noop("distribute elements to a static subset of good peers"),
559 gettext_noop ("distribute elements to a static subset of good peers"), 559 &dist_static),
560 &dist_static), 560
561 561 GNUNET_GETOPT_option_flag('V',
562 GNUNET_GETOPT_option_flag ('V', 562 "verbose",
563 "verbose", 563 gettext_noop("be more verbose (print received values)"),
564 gettext_noop ("be more verbose (print received values)"), 564 &verbose),
565 &verbose), 565
566 566 GNUNET_GETOPT_OPTION_END
567 GNUNET_GETOPT_OPTION_END
568 }; 567 };
568
569 conclude_timeout = GNUNET_TIME_UNIT_SECONDS; 569 conclude_timeout = GNUNET_TIME_UNIT_SECONDS;
570 GNUNET_PROGRAM_run2 (argc, argv, "gnunet-consensus-profiler", 570 GNUNET_PROGRAM_run2(argc, argv, "gnunet-consensus-profiler",
571 "help", 571 "help",
572 options, &run, NULL, GNUNET_YES); 572 options, &run, NULL, GNUNET_YES);
573 return 0; 573 return 0;
574} 574}