aboutsummaryrefslogtreecommitdiff
path: root/src/nse
diff options
context:
space:
mode:
authorSree Harsha Totakura <totakura@in.tum.de>2013-03-19 09:58:55 +0000
committerSree Harsha Totakura <totakura@in.tum.de>2013-03-19 09:58:55 +0000
commit5df7f24fe0f8371c931b78a135c864af8e167c6a (patch)
tree8eaf46f077969aeaacc1767ba6b3e5ea6f88b920 /src/nse
parent453364efe4a8f3d1bfd57bca478d8b0ebc1d1fc8 (diff)
- working version of NSE profiler
Diffstat (limited to 'src/nse')
-rw-r--r--src/nse/gnunet-nse-profiler.c31
-rw-r--r--src/nse/nse_profiler_test.conf75
2 files changed, 34 insertions, 72 deletions
diff --git a/src/nse/gnunet-nse-profiler.c b/src/nse/gnunet-nse-profiler.c
index 5777916a03..391a7656f6 100644
--- a/src/nse/gnunet-nse-profiler.c
+++ b/src/nse/gnunet-nse-profiler.c
@@ -382,13 +382,16 @@ connect_nse_service ()
{
struct NSEPeer *current_peer;
unsigned int i;
+ unsigned int connections;
+ if (0 == connection_limit)
+ return;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connecting to nse service of peers\n");
- for (i = 0; i < num_peers; i++)
+ connections = 0;
+ for (i = 0; i < num_peers_in_round[current_round]; i++)
{
- if ((connection_limit > 0) &&
- (num_peers > connection_limit) &&
- (0 != (i % (num_peers / connection_limit))))
+ if ((num_peers_in_round[current_round] > connection_limit) &&
+ (0 != (i % (num_peers_in_round[current_round] / connection_limit))))
continue;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"nse-profiler: connecting to nse service of peer %d\n", i);
@@ -401,8 +404,10 @@ connect_nse_service ()
NULL, NULL,
&nse_connect_adapter,
&nse_disconnect_adapter,
- current_peer);
+ current_peer);
GNUNET_CONTAINER_DLL_insert (peer_head, peer_tail, current_peer);
+ if (++connections == connection_limit)
+ break;
}
}
@@ -448,6 +453,7 @@ stats_finished_callback (void *cls,
GNUNET_free (stats_context);
return;
}
+ LOG_DEBUG ("Finished collecting statistics\n");
if (NULL != data_file)
{
/* Stats lookup successful, write out data */
@@ -589,9 +595,7 @@ finish_round (void *cls,
char buf[1024];
size_t buf_len;
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Have %u connections\n",
- total_connections);
+ LOG (GNUNET_ERROR_TYPE_INFO, "Have %u connections\n", total_connections);
if (NULL != data_file)
{
buf_len = GNUNET_snprintf (buf, sizeof (buf),
@@ -655,6 +659,8 @@ peer_churn_cb (void *cls, const char *emsg)
GNUNET_TESTBED_operation_done (entry->op);
GNUNET_CONTAINER_DLL_remove (oplist_head, oplist_tail, entry);
GNUNET_free (entry);
+ if (num_peers_in_round[current_round] == peers_running)
+ run_round ();
}
@@ -707,6 +713,7 @@ next_round (void *cls,
if (current_round == num_rounds)
{
/* this was the last round, terminate */
+ ok = 0;
GNUNET_SCHEDULER_shutdown ();
return;
}
@@ -735,13 +742,9 @@ master_controller_cb (void *cls,
{
case GNUNET_TESTBED_ET_PEER_START:
peers_running++;
- if (num_peers_in_round[current_round] == peers_running)
- run_round ();
break;
case GNUNET_TESTBED_ET_PEER_STOP:
peers_running--;
- if (num_peers_in_round[current_round] == peers_running)
- run_round ();
break;
case GNUNET_TESTBED_ET_CONNECT:
total_connections++;
@@ -817,7 +820,7 @@ run (void *cls, char *const *args, const char *cfgfile,
fprintf (stderr, "Refusing to run a round with 0 peers\n");
return;
}
- GNUNET_array_grow (num_peers_in_round, num_rounds, num);
+ GNUNET_array_append (num_peers_in_round, num_rounds, num);
num_peers = GNUNET_MAX (num_peers, num);
}
if (0 == num_peers)
@@ -875,7 +878,7 @@ main (int argc, char *const *argv)
static struct GNUNET_GETOPT_CommandLineOption options[] = {
{'C', "connections", "COUNT",
gettext_noop ("limit to the number of connections to NSE services, 0 for none"),
- 1, &GNUNET_GETOPT_set_string, &num_peer_spec},
+ 1, &GNUNET_GETOPT_set_uint, &connection_limit},
{'d', "details", "FILENAME",
gettext_noop ("name of the file for writing connection information and statistics"),
1, &GNUNET_GETOPT_set_string, &data_filename},
diff --git a/src/nse/nse_profiler_test.conf b/src/nse/nse_profiler_test.conf
index 398eb27def..b9d0c3efcc 100644
--- a/src/nse/nse_profiler_test.conf
+++ b/src/nse/nse_profiler_test.conf
@@ -1,8 +1,18 @@
[PATHS]
SERVICEHOME = /tmp/nse-profiler/
+[testbed]
+AUTOSTART = NO
+PORT = 12113
+ACCEPT_FROM = 127.0.0.1; 10.6.0.0/16;
+HOSTNAME = localhost
+MAX_PARALLEL_TOPOLOGY_CONFIG_OPERATIONS = 5
+OVERLAY_TOPOLOGY = RANDOM
+OVERLAY_RANDOM_LINKS = 10
+OPERATION_TIMEOUT = 45 s
+
[nse]
-PORT = 0
+PORT = 12114
UNIXPATH = /tmp/test-nse-service-nse.unix
BINARY = gnunet-service-nse
#BINARY = /home/mrwiggles/documents/research/gnunet/gnunet-ng/src/nse/.libs/gnunet-service-nse
@@ -16,28 +26,24 @@ WORKBITS = 0
PROOFFILE = $SERVICEHOME/nse.proof
[arm]
-PORT = 0
-DEFAULTSERVICES = core
+DEFAULTSERVICES = core nse
UNIXPATH = /tmp/test-nse-service-arm.unix
[statistics]
AUTOSTART = YES
-PORT=0
+PORT = 12115
[fs]
AUTOSTART = NO
-PORT=0
[datastore]
AUTOSTART = NO
-PORT = 0
[dht]
AUTOSTART = NO
-PORT = 0
[nat]
-DISABLEV6 = YES
+DISABLEV6 = YES
BINDTO = 127.0.0.1
ENABLE_UPNP = NO
BEHIND_NAT = NO
@@ -46,31 +52,16 @@ INTERNAL_ADDRESS = 127.0.0.1
EXTERNAL_ADDRESS = 127.0.0.1
[transport]
-PORT = 0
-plugins = unix
-
-[transport-unix]
-PORT = 1
-
-[transport-tcp]
-PORT = 0
+plugins = udp
[transport-udp]
-PORT = 0
-
-[transport-http]
-PORT = 0
-
-[transport-https]
-PORT = 0
+PORT = 12116
[core]
AUTOSTART = YES
-PORT = 0
[peerinfo]
AUTOSTART = YES
-PORT = 0
[dns]
AUTOSTART = NO
@@ -82,10 +73,7 @@ AUTOSTART = NO
AUTOSTART = NO
[resolver]
-PORT = 0
-
-[ats]
-PORT = 0
+AUTOSTART = YES
[mesh]
AUTOSTART = NO
@@ -99,35 +87,6 @@ AUTOSTART = NO
[vpn]
AUTOSTART = NO
-[testing]
-WEAKRANDOM = YES
-
-[testing_old]
-NUM_PEERS = 2000
-TOPOLOGY = NONE
-#CONNECT_TOPOLOGY = SMALL_WORLD_RING
-CONNECT_TOPOLOGY = ERDOS_RENYI
-CONNECT_TOPOLOGY_OPTION = CONNECT_MINIMUM
-CONNECT_TOPOLOGY_OPTION_MODIFIER = 5
-# PERCENTAGE = 3
-PROBABILITY = .1
-F2F = NO
-CONNECT_TIMEOUT = 360 s
-CONNECT_ATTEMPTS = 3
-#HOSTKEYSFILE = ../../contrib/testing_hostkeys.dat
-HOSTKEYSFILE = hostkeys.dat
-MAX_CONCURRENT_SSH = 20
-USE_PROGRESSBARS = YES
-PEERGROUP_TIMEOUT = 1000 s
-TOPOLOGY_OUTPUT_FILE = nse_topo_2000_peers_initial
-MAX_OUTSTANDING_CONNECTIONS = 100
-#SINGLE_PEERINFO_PER_HOST = YES
-#NUM_PEERINFO_PER_HOST = 10
-#SINGLE_STATISTICS_PER_HOST = YES
-#NUM_STATISTICS_PER_HOST = 10
-DELETE_FILES = NO
-#SKEW_VARIANCE = 30000
-
[nse-profiler]
OUTPUT_FILE = nse_output_2000_peers.dat
TOPOLOGY_OUTPUT_FILE = nse_topo_2000_peers