[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r24535 - gnunet/src/mesh
From: |
gnunet |
Subject: |
[GNUnet-SVN] r24535 - gnunet/src/mesh |
Date: |
Thu, 25 Oct 2012 13:57:32 +0200 |
Author: szengel
Date: 2012-10-25 13:57:32 +0200 (Thu, 25 Oct 2012)
New Revision: 24535
Modified:
gnunet/src/mesh/gnunet-regex-profiler.c
gnunet/src/mesh/regex_profiler_test.conf
Log:
regex profiler fixes
Modified: gnunet/src/mesh/gnunet-regex-profiler.c
===================================================================
--- gnunet/src/mesh/gnunet-regex-profiler.c 2012-10-25 11:47:56 UTC (rev
24534)
+++ gnunet/src/mesh/gnunet-regex-profiler.c 2012-10-25 11:57:32 UTC (rev
24535)
@@ -159,6 +159,11 @@
* Testbed operation handle for the statistics service.
*/
struct GNUNET_TESTBED_Operation *stats_op_handle;
+
+ /**
+ * The starting time of a profiling step.
+ */
+ struct GNUNET_TIME_Absolute prof_start_time;
};
/**
@@ -248,6 +253,11 @@
static unsigned int num_hosts;
/**
+ * Factor of number of links. num_links = num_peers * linking_factor.
+ */
+static unsigned int linking_factor;
+
+/**
* Number of random links to be established between peers
*/
static unsigned int num_links;
@@ -329,7 +339,46 @@
static char *data_filename;
+/******************************************************************************/
+/****************************** DECLARATIONS
********************************/
+/******************************************************************************/
+
+
/**
+ * Method called whenever a peer has connected to the tunnel.
+ *
+ * @param cls closure
+ * @param peer_id peer identity the tunnel was created to, NULL on timeout
+ * @param atsi performance data for the connection
+ *
+ */
+void
+mesh_peer_connect_handler (void *cls,
+ const struct GNUNET_PeerIdentity* peer_id,
+ const struct GNUNET_ATS_Information * atsi);
+
+
+/**
+ * Method called whenever a peer has disconnected from the tunnel.
+ * Implementations of this callback must NOT call
+ * GNUNET_MESH_tunnel_destroy immediately, but instead schedule those
+ * to run in some other task later. However, calling
+ * "GNUNET_MESH_notify_transmit_ready_cancel" is allowed.
+ *
+ * @param cls closure
+ * @param peer_id peer identity the tunnel stopped working with
+ */
+void
+mesh_peer_disconnect_handler (void *cls,
+ const struct GNUNET_PeerIdentity * peer_id);
+
+
+/******************************************************************************/
+/******************************** SHUTDOWN
**********************************/
+/******************************************************************************/
+
+
+/**
* Shutdown nicely
*
* @param cls NULL
@@ -497,6 +546,9 @@
return;
}
+ GNUNET_TESTBED_operation_done (peer->stats_op_handle);
+ peer->stats_op_handle = NULL;
+
if (++peer_cnt == num_search_strings)
{
GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
@@ -525,11 +577,21 @@
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to connect to statistics service on peer %u: %s\n",
peer->id, emsg);
- GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
return;
}
peer->stats_handle = ca_result;
+
+ peer->mesh_tunnel_handle = GNUNET_MESH_tunnel_create (peer->mesh_handle,
+ NULL,
+
&mesh_peer_connect_handler,
+
&mesh_peer_disconnect_handler,
+ peer);
+
+ peer->prof_start_time = GNUNET_TIME_absolute_get ();
+
+ GNUNET_MESH_peer_request_connect_by_string (peer->mesh_tunnel_handle,
+ peer->search_str);
}
@@ -628,7 +690,7 @@
}
else
{
- prof_time = GNUNET_TIME_absolute_get_duration (prof_start_time);
+ prof_time = GNUNET_TIME_absolute_get_duration (peer->prof_start_time);
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"String %s successfully matched on peer %u after %s (%i/%i)\n",
peer->search_str, peer->id,
GNUNET_STRINGS_relative_time_to_string (prof_time, GNUNET_NO),
@@ -683,6 +745,8 @@
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"All strings successfully matched in %s\n",
GNUNET_STRINGS_relative_time_to_string (prof_time, GNUNET_NO));
+ printf ("All strings successfully matched. Shutting down.\n");
+ fflush (stdout);
if (GNUNET_SCHEDULER_NO_TASK != search_timeout_task)
GNUNET_SCHEDULER_cancel (search_timeout_task);
@@ -732,18 +796,18 @@
"Searching for string \"%s\" on peer %d with file %s\n",
peer->search_str, (search_cnt % num_peers), peer->policy_file);
- peer->mesh_tunnel_handle = GNUNET_MESH_tunnel_create (peer->mesh_handle,
- NULL,
-
&mesh_peer_connect_handler,
-
&mesh_peer_disconnect_handler,
- peer);
-
- GNUNET_MESH_peer_request_connect_by_string (peer->mesh_tunnel_handle,
- peer->search_str);
+ /* First connect to stats service, then try connecting by string in
stats_connect_cb */
+ peer->stats_op_handle =
+ GNUNET_TESTBED_service_connect (NULL,
+ peers->peer_handle,
+ "statistics",
+ &stats_connect_cb,
+ peer,
+ &stats_ca,
+ &stats_da,
+ peer);
}
- prof_start_time = GNUNET_TIME_absolute_get ();
-
search_timeout_task = GNUNET_SCHEDULER_add_delayed (search_timeout,
&do_connect_by_string_timeout, NULL);
}
@@ -827,7 +891,7 @@
if (++connected_mesh_handles == num_peers)
{
- printf ("Waiting %s before starting to search.\n",
+ printf ("\nWaiting %s before starting to search.\n",
GNUNET_STRINGS_relative_time_to_string (search_delay, GNUNET_YES));
fflush (stdout);
@@ -938,13 +1002,14 @@
GNUNET_STRINGS_relative_time_to_string (prof_time, GNUNET_NO));
result = GNUNET_OK;
- if (0 == num_links)
- num_links = num_peers * 5;
-
peer_handles = GNUNET_malloc (sizeof (struct GNUNET_TESTBED_Peer *) *
num_peers);
for (peer_cnt = 0; peer_cnt < num_peers; peer_cnt++)
peer_handles[peer_cnt] = peers[peer_cnt].peer_handle;
+ if (0 == linking_factor)
+ linking_factor = 1;
+ num_links = linking_factor * num_peers;
+
state = STATE_PEERS_LINKING;
/* Do overlay connect */
prof_start_time = GNUNET_TIME_absolute_get ();
@@ -1155,7 +1220,7 @@
printf ("F");
fflush (stdout);
retry_links++;
-
+
if (++cont_fails > num_cont_fails)
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
@@ -1181,7 +1246,6 @@
}
if (++established_links == num_links)
{
- printf ("\n");
fflush (stdout);
prof_time = GNUNET_TIME_absolute_get_duration (prof_start_time);
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
@@ -1219,16 +1283,6 @@
&mesh_ca,
&mesh_da,
&peers[peer_cnt]);
-
- peers[peer_cnt].stats_op_handle =
- GNUNET_TESTBED_service_connect (NULL,
- peers[peer_cnt].peer_handle,
- "statistics",
- &stats_connect_cb,
- &peers[peer_cnt],
- &stats_ca,
- &stats_da,
- &peers[peer_cnt]);
}
}
}
@@ -1238,6 +1292,8 @@
}
break;
default:
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Unexpected controller_cb with state %i!\n", state);
GNUNET_assert (0);
}
}
@@ -1539,9 +1595,9 @@
{'d', "details", "FILENAME",
gettext_noop ("name of the file for writing statistics"),
1, &GNUNET_GETOPT_set_string, &data_filename},
- { 'n', "num-links", "COUNT",
- gettext_noop ("create COUNT number of random links"),
- GNUNET_YES, &GNUNET_GETOPT_set_uint, &num_links },
+ { 'n', "linking-factor", "FACTOR",
+ gettext_noop ("create FACTOR times number of peers random links"),
+ GNUNET_YES, &GNUNET_GETOPT_set_uint, &linking_factor },
{ 'e', "num-errors", "COUNT",
gettext_noop ("tolerate COUNT number of continious timeout failures"),
GNUNET_YES, &GNUNET_GETOPT_set_uint, &num_cont_fails },
Modified: gnunet/src/mesh/regex_profiler_test.conf
===================================================================
--- gnunet/src/mesh/regex_profiler_test.conf 2012-10-25 11:47:56 UTC (rev
24534)
+++ gnunet/src/mesh/regex_profiler_test.conf 2012-10-25 11:57:32 UTC (rev
24535)
@@ -3,8 +3,9 @@
PORT = 12000
ACCEPT_FROM = 127.0.0.1; 192.168.1.0/24;
HOSTNAME = localhost
-MAX_PARALLEL_TOPOLOGY_CONFIG_OPERATIONS = 5
-MAX_PARALLEL_OVERLAY_CONNECT_OPERATIONS = 5
+MAX_PARALLEL_OVERLAY_CONNECT_OPERATIONS = 200
+MAX_PARALLEL_OPERATIONS = 10000
+MAX_PARALLEL_SERVICE_CONNECTIONS = 10000
[mesh]
AUTOSTART = YES
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r24535 - gnunet/src/mesh,
gnunet <=