aboutsummaryrefslogtreecommitdiff
path: root/src/ats-tests
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2013-09-19 12:25:28 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2013-09-19 12:25:28 +0000
commit9daee8a187e78bd9e860f2f34729e80cc95f414c (patch)
treef059b5d84fc7bcf996b6e3e2fe9445fc47e89707 /src/ats-tests
parent33d7922f5f3ebbf4239f105b7cf030f3e3cc7733 (diff)
added logging frequency
Diffstat (limited to 'src/ats-tests')
-rw-r--r--src/ats-tests/perf_ats.c27
-rw-r--r--src/ats-tests/perf_ats.h4
-rw-r--r--src/ats-tests/perf_ats_logging.c9
3 files changed, 34 insertions, 6 deletions
diff --git a/src/ats-tests/perf_ats.c b/src/ats-tests/perf_ats.c
index c4689ad0c5..e6c878b641 100644
--- a/src/ats-tests/perf_ats.c
+++ b/src/ats-tests/perf_ats.c
@@ -151,6 +151,11 @@ static struct BenchmarkPeer *sps;
static struct GNUNET_TIME_Relative perf_duration;
/**
+ * Logging frequency
+ */
+static struct GNUNET_TIME_Relative log_frequency;
+
+/**
* Benchmark state
*/
static struct BenchmarkState state;
@@ -456,7 +461,7 @@ do_benchmark ()
mps[c_m].ats_task = GNUNET_SCHEDULER_add_now (&ats_pref_task, &mps[c_m]);
}
if (GNUNET_YES == logging)
- perf_logging_start (testname, mps, num_masters);
+ perf_logging_start (log_frequency, testname, mps, num_masters);
}
@@ -1229,6 +1234,26 @@ main (int argc, char *argv[])
logging = GNUNET_YES;
}
+ if (GNUNET_YES == logging)
+ {
+ for (c = 0; c < (argc - 1); c++)
+ {
+ if (0 == strcmp (argv[c], "-f"))
+ break;
+ }
+ if (c < argc - 1)
+ {
+ if (GNUNET_OK != GNUNET_STRINGS_fancy_time_to_relative (argv[c + 1], &log_frequency))
+ fprintf (stderr, "Failed to parse duration `%s'\n", argv[c + 1]);
+ }
+ else
+ {
+ log_frequency = LOGGING_FREQUENCY;
+ }
+ fprintf (stderr, "Using log frequency %llu ms\n",
+ (unsigned long long) (log_frequency.rel_value_us) / (1000));
+ }
+
GNUNET_asprintf (&testname, "%s_%s_%s",solver, comm_name, pref_str);
if (num_slaves < num_masters)
diff --git a/src/ats-tests/perf_ats.h b/src/ats-tests/perf_ats.h
index e2525a0daf..58d4b7a81d 100644
--- a/src/ats-tests/perf_ats.h
+++ b/src/ats-tests/perf_ats.h
@@ -31,6 +31,7 @@
#define TEST_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30)
#define BENCHMARK_DURATION GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10)
+#define LOGGING_FREQUENCY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 500)
#define TESTNAME_PREFIX "perf_ats_"
#define DEFAULT_SLAVES_NUM 3
#define DEFAULT_MASTERS_NUM 1
@@ -218,7 +219,8 @@ void
perf_logging_stop ();
void
-perf_logging_start (char * testname, struct BenchmarkPeer *masters, int num_masters);
+perf_logging_start (struct GNUNET_TIME_Relative log_frequency,
+ char * testname, struct BenchmarkPeer *masters, int num_masters);
/* end of file perf_ats.h */
diff --git a/src/ats-tests/perf_ats_logging.c b/src/ats-tests/perf_ats_logging.c
index 055ad72723..592c1070fb 100644
--- a/src/ats-tests/perf_ats_logging.c
+++ b/src/ats-tests/perf_ats_logging.c
@@ -27,8 +27,6 @@
#include "gnunet_util_lib.h"
#include "perf_ats.h"
-#define LOGGING_FREQUENCY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 500)
-
#define THROUGHPUT_TEMPLATE "#!/usr/bin/gnuplot \n" \
"set datafile separator ';' \n" \
"set title \"Throughput\" \n" \
@@ -46,6 +44,7 @@ static GNUNET_SCHEDULER_TaskIdentifier log_task;
static int num_peers;
static int running;
static char *name;
+static struct GNUNET_TIME_Relative frequency;
/**
* A single logging time step for a partner
@@ -370,7 +369,7 @@ collect_log_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
if (tc->reason == GNUNET_SCHEDULER_REASON_SHUTDOWN)
return;
- log_task = GNUNET_SCHEDULER_add_delayed (LOGGING_FREQUENCY,
+ log_task = GNUNET_SCHEDULER_add_delayed (frequency,
&collect_log_task, NULL);
}
@@ -410,7 +409,8 @@ perf_logging_stop ()
}
void
-perf_logging_start (char * testname, struct BenchmarkPeer *masters, int num_masters)
+perf_logging_start (struct GNUNET_TIME_Relative log_frequency,
+ char * testname, struct BenchmarkPeer *masters, int num_masters)
{
int c_m;
GNUNET_log(GNUNET_ERROR_TYPE_INFO,
@@ -418,6 +418,7 @@ perf_logging_start (char * testname, struct BenchmarkPeer *masters, int num_mast
num_peers = num_masters;
name = testname;
+ frequency = log_frequency;
lp = GNUNET_malloc (num_masters * sizeof (struct LoggingPeer));