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