diff options
author | Maximilian Szengel <gnunet@maxsz.de> | 2012-10-22 13:52:59 +0000 |
---|---|---|
committer | Maximilian Szengel <gnunet@maxsz.de> | 2012-10-22 13:52:59 +0000 |
commit | 7dd79b89c8aaf6d97619aee3c8dca2934f9092c8 (patch) | |
tree | 6039f4b95161dc40dbb5d5d1f8c70abb89d3e81e | |
parent | ad39dd23742ae26a43a67bbaeda0a10cc7f1eab9 (diff) | |
download | gnunet-7dd79b89c8aaf6d97619aee3c8dca2934f9092c8.tar.gz gnunet-7dd79b89c8aaf6d97619aee3c8dca2934f9092c8.zip |
regex profiler: measuring the time it takes to match all strings
-rw-r--r-- | src/mesh/gnunet-regex-profiler.c | 34 | ||||
-rw-r--r-- | src/mesh/regex_profiler_test.conf | 6 |
2 files changed, 29 insertions, 11 deletions
diff --git a/src/mesh/gnunet-regex-profiler.c b/src/mesh/gnunet-regex-profiler.c index 1f5edf68f..50c598c68 100644 --- a/src/mesh/gnunet-regex-profiler.c +++ b/src/mesh/gnunet-regex-profiler.c | |||
@@ -443,15 +443,28 @@ mesh_peer_connect_handler (void *cls, | |||
443 | const struct GNUNET_PeerIdentity* peer_id, | 443 | const struct GNUNET_PeerIdentity* peer_id, |
444 | const struct GNUNET_ATS_Information * atsi) | 444 | const struct GNUNET_ATS_Information * atsi) |
445 | { | 445 | { |
446 | // struct Peer *peer = (struct Peer *)cls; | ||
447 | const char * search_str = (const char *)cls; | 446 | const char * search_str = (const char *)cls; |
448 | 447 | ||
449 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Mesh peer connect handler.\n"); | 448 | peers_found++; |
450 | printf ("String %s successfully matched\n", search_str); | ||
451 | 449 | ||
452 | if (++peers_found == num_search_strings) | 450 | if (NULL == peer_id) |
453 | { | 451 | { |
454 | printf ("\nAll strings successfully matched!\n"); | 452 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
453 | "String matching timed out for string %s (%i/%i)\n", | ||
454 | search_str, peers_found, num_search_strings); | ||
455 | } | ||
456 | else | ||
457 | { | ||
458 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
459 | "String %s successfully matched (%i/%i)\n", | ||
460 | search_str, peers_found, num_search_strings); | ||
461 | } | ||
462 | |||
463 | if (peers_found == num_search_strings) | ||
464 | { | ||
465 | |||
466 | prof_time = GNUNET_TIME_absolute_get_duration (prof_start_time); | ||
467 | printf ("\nAll strings successfully matched in %.2f minutes\n", ((double)prof_time.rel_value / 1000.0 / 60.0)); | ||
455 | GNUNET_SCHEDULER_cancel (search_timeout_task); | 468 | GNUNET_SCHEDULER_cancel (search_timeout_task); |
456 | GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); | 469 | GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); |
457 | } | 470 | } |
@@ -494,7 +507,8 @@ do_connect_by_string (void *cls, | |||
494 | { | 507 | { |
495 | peer = &peers[search_cnt % num_peers]; | 508 | peer = &peers[search_cnt % num_peers]; |
496 | 509 | ||
497 | printf ("Searching for string \"%s\"\n", search_strings[search_cnt]); | 510 | printf ("Searching for string \"%s\" on peer %d\n", |
511 | search_strings[search_cnt], (search_cnt % num_peers)); | ||
498 | 512 | ||
499 | peer->mesh_tunnel_handle = GNUNET_MESH_tunnel_create (peer->mesh_handle, | 513 | peer->mesh_tunnel_handle = GNUNET_MESH_tunnel_create (peer->mesh_handle, |
500 | NULL, | 514 | NULL, |
@@ -506,6 +520,8 @@ do_connect_by_string (void *cls, | |||
506 | 520 | ||
507 | } | 521 | } |
508 | 522 | ||
523 | prof_start_time = GNUNET_TIME_absolute_get (); | ||
524 | |||
509 | search_timeout_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply | 525 | search_timeout_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply |
510 | (GNUNET_TIME_UNIT_SECONDS, search_timeout_sec), | 526 | (GNUNET_TIME_UNIT_SECONDS, search_timeout_sec), |
511 | &do_connect_by_string_timeout, (void *)search_timeout_sec); | 527 | &do_connect_by_string_timeout, (void *)search_timeout_sec); |
@@ -588,7 +604,8 @@ mesh_connect_cb (void *cls, struct GNUNET_TESTBED_Operation *op, | |||
588 | 604 | ||
589 | if (++connected_mesh_handles == num_peers) | 605 | if (++connected_mesh_handles == num_peers) |
590 | { | 606 | { |
591 | printf ("\nAll mesh handles connected.\nWaiting to search.\n"); | 607 | printf ("\nAll mesh handles connected.\nWaiting %ld minutes before starting to search.\n", |
608 | search_wait_min); | ||
592 | 609 | ||
593 | search_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply | 610 | search_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply |
594 | (GNUNET_TIME_UNIT_MINUTES, search_wait_min), | 611 | (GNUNET_TIME_UNIT_MINUTES, search_wait_min), |
@@ -701,7 +718,8 @@ peer_churn_cb (void *cls, const char *emsg) | |||
701 | topology_op = | 718 | topology_op = |
702 | GNUNET_TESTBED_overlay_configure_topology (NULL, num_peers, peer_handles, | 719 | GNUNET_TESTBED_overlay_configure_topology (NULL, num_peers, peer_handles, |
703 | GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI, | 720 | GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI, |
704 | num_links); | 721 | num_links, |
722 | GNUNET_TESTBED_TOPOLOGY_OPTION_END); | ||
705 | if (NULL == topology_op) | 723 | if (NULL == topology_op) |
706 | { | 724 | { |
707 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 725 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
diff --git a/src/mesh/regex_profiler_test.conf b/src/mesh/regex_profiler_test.conf index 97fce9265..d511f9527 100644 --- a/src/mesh/regex_profiler_test.conf +++ b/src/mesh/regex_profiler_test.conf | |||
@@ -14,9 +14,9 @@ AUTOSTART = NO | |||
14 | 14 | ||
15 | [mesh] | 15 | [mesh] |
16 | AUTOSTART = NO | 16 | AUTOSTART = NO |
17 | APP_ANNOUNCE_TIME = 4 s | 17 | APP_ANNOUNCE_TIME = 5 s |
18 | ID_ANNOUNCE_TIME = 4 s | 18 | ID_ANNOUNCE_TIME = 5 s |
19 | CONNECT_TIMEOUT = 30 s | 19 | CONNECT_TIMEOUT = 10 s |
20 | 20 | ||
21 | [dht] | 21 | [dht] |
22 | AUTOSTART = NO | 22 | AUTOSTART = NO |