From 80e91cc2d8e19a1aeead110ac1ac813d85247fd3 Mon Sep 17 00:00:00 2001 From: Matthias Wachs Date: Mon, 5 Aug 2013 13:32:17 +0000 Subject: [PATCH] confs and makefile --- src/ats/Makefile.am | 4 +- src/ats/perf_ats.c | 47 ++++++++++++++++++---- src/ats/perf_ats_simplistic_bandwidth.conf | 0 src/ats/perf_ats_simplistic_delay.conf | 0 4 files changed, 42 insertions(+), 9 deletions(-) create mode 100644 src/ats/perf_ats_simplistic_bandwidth.conf create mode 100644 src/ats/perf_ats_simplistic_delay.conf diff --git a/src/ats/Makefile.am b/src/ats/Makefile.am index 1d9a11518..40450d7f0 100644 --- a/src/ats/Makefile.am +++ b/src/ats/Makefile.am @@ -264,4 +264,6 @@ perf_ats_simplistic_delay_LDADD = \ EXTRA_DIST = \ ats.h \ test_ats_api.conf \ - test_ats_mlp.conf + test_ats_mlp.conf \ + perf_ats_simplistic_bandwidth.conf \ + perf_ats_simplistic_delay.conf diff --git a/src/ats/perf_ats.c b/src/ats/perf_ats.c index 1576361b7..5072c30a5 100644 --- a/src/ats/perf_ats.c +++ b/src/ats/perf_ats.c @@ -19,19 +19,24 @@ */ /** * @file ats/test_ats.c - * @brief ats benchmark + * @brief ats benchmark: start peers and modify preferences, monitor change over time * @author Christian Grothoff * @author Matthias Wachs */ #include "platform.h" #include "gnunet_util_lib.h" +#define TESTNAME_PREFIX "perf_ats_" + static int ret; +static char *solver; +static char *preference; static void check (void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg) { + GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Benchmarking solver `%s' on preference `%s'\n"), solver, preference); ret = 0; } @@ -39,13 +44,9 @@ check (void *cls, char *const *args, const char *cfgfile, int main (int argc, char *argv[]) { - - static char *const argv2[] = { "perf_ats", - "-c", - "perf_ats.conf", - "-L", "WARNING", - NULL - }; + char *tmp; + char *tmp_sep; + char *conf_name; ret = 1; @@ -53,10 +54,40 @@ main (int argc, char *argv[]) GNUNET_GETOPT_OPTION_END }; + /* figure out testname */ + tmp = strstr (argv[0], TESTNAME_PREFIX); + if (NULL == tmp) + { + fprintf (stderr, "Unable to parse test name `%s'\n", argv[0]); + return GNUNET_SYSERR; + } + tmp += strlen(TESTNAME_PREFIX); + solver = GNUNET_strdup (tmp); + tmp_sep = strchr (solver, '_'); + if (NULL == tmp_sep) + { + fprintf (stderr, "Unable to parse test name `%s'\n", argv[0]); + GNUNET_free (solver); + return GNUNET_SYSERR; + } + tmp_sep[0] = '\0'; + preference = GNUNET_strdup(tmp_sep + 1); + + GNUNET_asprintf(&conf_name, "%s%s_%s.conf", TESTNAME_PREFIX, solver, preference); + + char *argv2[] = { "perf_ats", + "-c", + conf_name, + "-L", "WARNING", + NULL + }; GNUNET_PROGRAM_run ((sizeof (argv2) / sizeof (char *)) - 1, argv2, "perf_ats", "nohelp", options, &check, NULL); + GNUNET_free (solver); + GNUNET_free (preference); + GNUNET_free (conf_name); return ret; } diff --git a/src/ats/perf_ats_simplistic_bandwidth.conf b/src/ats/perf_ats_simplistic_bandwidth.conf new file mode 100644 index 000000000..e69de29bb diff --git a/src/ats/perf_ats_simplistic_delay.conf b/src/ats/perf_ats_simplistic_delay.conf new file mode 100644 index 000000000..e69de29bb -- 2.25.1