From 458cb34da45e855162c96fc4735f168e36a323c9 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 23 Oct 2011 13:35:03 +0000 Subject: make writing data_output optional and disable by default --- src/dht/test_dht_2dtorus.c | 23 +++++++++-------------- src/dht/test_dht_2dtorus.conf | 2 +- src/mesh/test_mesh_small.c | 23 +++++++++-------------- src/mesh/test_mesh_small.conf | 2 +- src/mesh/test_mesh_small_unicast_far.c | 24 ++++++++++-------------- src/nse/gnunet-nse-profiler.c | 29 ++++++++++++----------------- src/nse/nse_profiler_test.conf | 2 +- 7 files changed, 43 insertions(+), 62 deletions(-) diff --git a/src/dht/test_dht_2dtorus.c b/src/dht/test_dht_2dtorus.c index cc2520580..1cc0e7980 100644 --- a/src/dht/test_dht_2dtorus.c +++ b/src/dht/test_dht_2dtorus.c @@ -103,8 +103,6 @@ static GNUNET_SCHEDULER_TaskIdentifier shutdown_handle; static char *topology_file; -static char *data_filename; - struct GNUNET_TESTING_Daemon *d1; struct GNUNET_TESTING_Daemon *d2; @@ -472,6 +470,7 @@ run (void *cls, char *const *args, const char *cfgfile, { char *temp_str; struct GNUNET_TESTING_Host *hosts; + char *data_filename; ok = 1; testing_cfg = GNUNET_CONFIGURATION_dup (cfg); @@ -509,27 +508,23 @@ run (void *cls, char *const *args, const char *cfgfile, return; } - if (GNUNET_OK != + if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (testing_cfg, "test_dht_2dtorus", "data_output_file", &data_filename)) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Option test_dht_2d:data_output_file is required!\n"); - return; - } - - data_file = + data_file = GNUNET_DISK_file_open (data_filename, GNUNET_DISK_OPEN_READWRITE | GNUNET_DISK_OPEN_CREATE, GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE); - if (data_file == NULL) - { - GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Failed to open %s for output!\n", - data_filename); - GNUNET_free (data_filename); + if (data_file == NULL) + { + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Failed to open %s for output!\n", + data_filename); + GNUNET_free (data_filename); + } } if (GNUNET_YES == diff --git a/src/dht/test_dht_2dtorus.conf b/src/dht/test_dht_2dtorus.conf index e49810569..20ca30e3f 100644 --- a/src/dht/test_dht_2dtorus.conf +++ b/src/dht/test_dht_2dtorus.conf @@ -75,4 +75,4 @@ DELETE_FILES = YES [test_dht_2dtorus] CONNECTION_LIMIT = 16 -DATA_OUTPUT_FILE=data_output +#DATA_OUTPUT_FILE=data_output diff --git a/src/mesh/test_mesh_small.c b/src/mesh/test_mesh_small.c index f100a40e4..0888c1e00 100644 --- a/src/mesh/test_mesh_small.c +++ b/src/mesh/test_mesh_small.c @@ -140,8 +140,6 @@ static GNUNET_SCHEDULER_TaskIdentifier shutdown_handle; static char *topology_file; -static char *data_filename; - static struct GNUNET_TESTING_Daemon *d1; static GNUNET_PEER_Id pid1; @@ -753,6 +751,7 @@ run (void *cls, char *const *args, const char *cfgfile, char *temp_str; unsigned long long temp_wait; struct GNUNET_TESTING_Host *hosts; + char *data_filename; ok = 0; testing_cfg = GNUNET_CONFIGURATION_dup (cfg); @@ -801,27 +800,23 @@ run (void *cls, char *const *args, const char *cfgfile, return; } - if (GNUNET_OK != + if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (testing_cfg, "test_mesh_small", "data_output_file", &data_filename)) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Option test_mesh_small:data_output_file is required!\n"); - return; - } - - data_file = + data_file = GNUNET_DISK_file_open (data_filename, GNUNET_DISK_OPEN_READWRITE | GNUNET_DISK_OPEN_CREATE, GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE); - if (data_file == NULL) - { - GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Failed to open %s for output!\n", - data_filename); - GNUNET_free (data_filename); + if (data_file == NULL) + { + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Failed to open %s for output!\n", + data_filename); + GNUNET_free (data_filename); + } } wait_time = diff --git a/src/mesh/test_mesh_small.conf b/src/mesh/test_mesh_small.conf index f98dca7dc..9e340aacb 100644 --- a/src/mesh/test_mesh_small.conf +++ b/src/mesh/test_mesh_small.conf @@ -87,4 +87,4 @@ DELETE_FILES = YES [test_mesh_small] WAIT_TIME = 300 CONNECTION_LIMIT = 16 -DATA_OUTPUT_FILE=data_output +#DATA_OUTPUT_FILE=data_output diff --git a/src/mesh/test_mesh_small_unicast_far.c b/src/mesh/test_mesh_small_unicast_far.c index d5a768f98..f5bab6fb4 100644 --- a/src/mesh/test_mesh_small_unicast_far.c +++ b/src/mesh/test_mesh_small_unicast_far.c @@ -120,8 +120,6 @@ static GNUNET_SCHEDULER_TaskIdentifier shutdown_handle; static char *topology_file; -static char *data_filename; - static struct GNUNET_TESTING_Daemon *d1; static struct GNUNET_TESTING_Daemon *d2; @@ -460,6 +458,8 @@ run (void *cls, char *const *args, const char *cfgfile, char *temp_str; unsigned long long temp_wait; struct GNUNET_TESTING_Host *hosts; + char *data_filename; + ok = 1; testing_cfg = GNUNET_CONFIGURATION_dup (cfg); @@ -516,27 +516,23 @@ run (void *cls, char *const *args, const char *cfgfile, return; } - if (GNUNET_OK != + if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (testing_cfg, "test_mesh_small", "data_output_file", &data_filename)) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Option test_mesh_small:data_output_file is required!\n"); - return; - } - - data_file = + data_file = GNUNET_DISK_file_open (data_filename, GNUNET_DISK_OPEN_READWRITE | GNUNET_DISK_OPEN_CREATE, GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE); - if (data_file == NULL) - { - GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Failed to open %s for output!\n", - data_filename); - GNUNET_free (data_filename); + if (data_file == NULL) + { + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Failed to open %s for output!\n", + data_filename); + GNUNET_free (data_filename); + } } wait_time = diff --git a/src/nse/gnunet-nse-profiler.c b/src/nse/gnunet-nse-profiler.c index a18a13fbd..ecd594e86 100644 --- a/src/nse/gnunet-nse-profiler.c +++ b/src/nse/gnunet-nse-profiler.c @@ -137,8 +137,6 @@ static GNUNET_SCHEDULER_TaskIdentifier churn_task; static char *topology_file; -static char *data_filename; - static uint64_t clock_skew; /** @@ -540,6 +538,7 @@ run (void *cls, char *const *args, const char *cfgfile, char *temp_str; unsigned long long temp_wait; struct GNUNET_TESTING_Host *hosts; + char *data_filename; ok = 1; testing_cfg = GNUNET_CONFIGURATION_create (); @@ -584,14 +583,21 @@ run (void *cls, char *const *args, const char *cfgfile, return; } - if (GNUNET_OK != + if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (testing_cfg, "nse-profiler", "data_output_file", &data_filename)) { - GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Option nse-profiler:data_output_file is required!\n"); - return; + data_file = + GNUNET_DISK_file_open (data_filename, + GNUNET_DISK_OPEN_READWRITE | + GNUNET_DISK_OPEN_CREATE, + GNUNET_DISK_PERM_USER_READ | + GNUNET_DISK_PERM_USER_WRITE); + if (data_file == NULL) + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Failed to open %s for output!\n", + data_filename); + GNUNET_free (data_filename); } if (GNUNET_YES == @@ -605,17 +611,6 @@ run (void *cls, char *const *args, const char *cfgfile, } - data_file = - GNUNET_DISK_file_open (data_filename, - GNUNET_DISK_OPEN_READWRITE | - GNUNET_DISK_OPEN_CREATE, - GNUNET_DISK_PERM_USER_READ | - GNUNET_DISK_PERM_USER_WRITE); - if (data_file == NULL) - GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Failed to open %s for output!\n", - data_filename); - GNUNET_free (data_filename); - wait_time = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, temp_wait); diff --git a/src/nse/nse_profiler_test.conf b/src/nse/nse_profiler_test.conf index ad113b24f..411bad9f0 100644 --- a/src/nse/nse_profiler_test.conf +++ b/src/nse/nse_profiler_test.conf @@ -98,7 +98,7 @@ DELETE_FILES = NO [nse-profiler] #OUTPUT_FILE = nse_output_100_peers.dat TOPOLOGY_OUTPUT_FILE = nse_topo_100_peers -DATA_OUTPUT_FILE = nse_topo_100_peers_stats +#DATA_OUTPUT_FILE = nse_topo_100_peers_stats #ROUND0 = 90 #ROUND1 = 100 #ROUND2 = 50 -- cgit v1.2.3