summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac3
-rw-r--r--contrib/Makefile.inc3
-rw-r--r--debian/changelog7
-rw-r--r--debian/control1
-rwxr-xr-xdebian/rules4
-rw-r--r--po/POTFILES.in3
-rw-r--r--src/Makefile.am2
-rw-r--r--src/ats-tests/.gitignore14
-rw-r--r--src/ats-tests/Makefile.am170
-rw-r--r--src/ats-tests/ats-testing-experiment.c820
-rw-r--r--src/ats-tests/ats-testing-log.c979
-rw-r--r--src/ats-tests/ats-testing-preferences.c265
-rw-r--r--src/ats-tests/ats-testing-traffic.c393
-rw-r--r--src/ats-tests/ats-testing.c975
-rw-r--r--src/ats-tests/ats-testing.h757
-rw-r--r--src/ats-tests/experiments/evaluation1_dru_3_peers_1addr_1scope_prop.conf24
-rw-r--r--src/ats-tests/experiments/evaluation1_dru_3_peers_1addr_1scope_prop.exp46
-rw-r--r--src/ats-tests/experiments/send_linear_10_sec.exp30
-rw-r--r--src/ats-tests/experiments/test.exp55
-rw-r--r--src/ats-tests/gnunet-ats-sim.c399
-rw-r--r--src/ats-tests/gnunet-solver-eval.c1025
-rw-r--r--src/ats-tests/gnunet_ats_sim_default.conf6
-rw-r--r--src/ats-tests/perf_ats.c601
-rw-r--r--src/ats-tests/perf_ats.h256
-rw-r--r--src/ats-tests/perf_ats_logging.c780
-rw-r--r--src/ats-tests/perf_ats_proportional_bandwidth.conf4
-rw-r--r--src/ats-tests/perf_ats_proportional_latency.conf4
-rw-r--r--src/ats-tests/perf_ats_proportional_none.conf4
-rw-r--r--src/ats-tests/template_perf_ats.conf52
-rw-r--r--src/block/Makefile.am13
-rw-r--r--src/dns/Makefile.am6
-rw-r--r--src/fs/Makefile.am4
-rw-r--r--src/gnsrecord/Makefile.am2
-rw-r--r--src/peerinfo-tool/Makefile.am8
-rw-r--r--src/reclaim/Makefile.am13
-rw-r--r--src/regex/Makefile.am3
-rw-r--r--src/revocation/Makefile.am5
-rw-r--r--src/testbed/Makefile.am6
-rw-r--r--src/testing/Makefile.am3
-rw-r--r--src/testing/testing_api_cmd_netjail_start_testsystem.c11
-rw-r--r--src/testing/testing_api_cmd_netjail_stop_testsystem.c5
-rw-r--r--src/transport/Makefile.am29
-rw-r--r--src/transport/transport_api_cmd_start_peer.c7
-rw-r--r--src/util/Makefile.am2
44 files changed, 44 insertions, 7755 deletions
diff --git a/configure.ac b/configure.ac
index 3b66a368e..945a0a23d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -21,7 +21,7 @@
#
AC_PREREQ([2.69])
# Checks for programs.
-AC_INIT([gnunet],[0.15.1],[bug-gnunet@gnu.org])
+AC_INIT([gnunet],[0.15.2],[bug-gnunet@gnu.org])
AC_CONFIG_AUX_DIR([build-aux])
# check for legacy option that is no longer supported (#5627) and fail hard
@@ -1921,7 +1921,6 @@ src/arm/arm.conf
src/ats/Makefile
src/ats/ats.conf
src/ats-tool/Makefile
-src/ats-tests/Makefile
src/auction/Makefile
src/block/Makefile
src/cadet/Makefile
diff --git a/contrib/Makefile.inc b/contrib/Makefile.inc
index a563ef4a1..c737a07f8 100644
--- a/contrib/Makefile.inc
+++ b/contrib/Makefile.inc
@@ -8,8 +8,7 @@ BUILDCOMMON_SHLIB_FILES = \
build-common/sh/lib.sh/existence_python.sh \
build-common/sh/lib.sh/msg.sh \
build-common/sh/lib.sh/progname.sh \
- build-common/sh/lib.sh/version_gnunet.sh \
- build-common/LICENSE
+ build-common/sh/lib.sh/version_gnunet.sh
BUILDCOMMON_CONF_FILES = \
build-common/conf/.dir-locals.el \
diff --git a/debian/changelog b/debian/changelog
index c20964fa2..21a78fb2e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+gnunet (0.15.2) unstable; urgency=low
+
+ * New upstream release, bumping version.
+ * Fixes linker issues. Very strange that Debian insists on explicit indirect dependencies for plugins.
+
+ -- Christian Grothoff <grothoff@gnu.org> Tue, 24 Aug 2021 21:14:18 +0200
+
gnunet (0.15.1) unstable; urgency=low
* New upstream release, bumping version.
diff --git a/debian/control b/debian/control
index 57acc6e1e..362cf1b2a 100644
--- a/debian/control
+++ b/debian/control
@@ -95,6 +95,7 @@ Section: libdevel
Architecture: any
Depends:
libgnunet (= ${binary:Version}),
+ gnunet (= ${binary:Version}),
libextractor-dev (>=1:0.6.3),
libgcrypt20-dev (>=1.6),
libmicrohttpd-dev (>=0.9.33),
diff --git a/debian/rules b/debian/rules
index 69f44aa80..b8d577405 100755
--- a/debian/rules
+++ b/debian/rules
@@ -46,7 +46,9 @@ override_dh_auto_clean:
rm -rf contrib/gnunet_janitor.py contrib/gnunet_pyexpect.py libltdl/ \
src/integration-tests/*.py
-# Remove files already present in libgnunet from main gnunet package
+# Remove files already present in libgnunet from main gnunet package and libgnunet-dev package
override_dh_install:
dh_install
cd debian/libgnunet; find . -type f,l -exec rm -f ../gnunet/{} \;
+ cd debian/libgnunet; find . -type f,l -exec rm -f ../libgnunet-dev/{} \;
+ cd debian/gnunet; find . -type f,l -exec rm -f ../libgnunet-dev/{} \;
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 00ca933da..e6aa9f39b 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -415,7 +415,6 @@ src/testbed/gnunet_mpi_test.c
src/testbed/gnunet_testbed_mpi_spawn.c
src/testbed/testbed_api.c
src/testbed/testbed_api_barriers.c
-src/testbed/testbed_api_cmd_netjail_start_testbed.c
src/testbed/testbed_api_hosts.c
src/testbed/testbed_api_operations.c
src/testbed/testbed_api_peers.c
@@ -441,6 +440,7 @@ src/testing/testing_api_cmd_netjail_stop.c
src/testing/testing_api_cmd_netjail_stop_testsystem.c
src/testing/testing_api_cmd_send_peer_ready.c
src/testing/testing_api_cmd_system_create.c
+src/testing/testing_api_cmd_system_destroy.c
src/testing/testing_api_loop.c
src/testing/testing_api_trait_cmd.c
src/testing/testing_api_trait_process.c
@@ -499,6 +499,7 @@ src/transport/transport_api_blacklist.c
src/transport/transport_api_cmd_connecting_peers.c
src/transport/transport_api_cmd_send_simple.c
src/transport/transport_api_cmd_start_peer.c
+src/transport/transport_api_cmd_stop_peer.c
src/transport/transport_api_core.c
src/transport/transport_api_hello_get.c
src/transport/transport_api_manipulation.c
diff --git a/src/Makefile.am b/src/Makefile.am
index 5df85f9db..ef8c5b110 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -3,7 +3,6 @@
if HAVE_TESTING
TESTING = testing
TESTBED = testbed-logger testbed
- ATS_TESTS = ats-tests
endif
if HAVE_EXPERIMENTAL
@@ -72,7 +71,6 @@ SUBDIRS = \
ats-tool \
core \
$(TESTBED) \
- $(ATS_TESTS) \
nse \
dhtu \
dht \
diff --git a/src/ats-tests/.gitignore b/src/ats-tests/.gitignore
deleted file mode 100644
index 5e15db496..000000000
--- a/src/ats-tests/.gitignore
+++ /dev/null
@@ -1,14 +0,0 @@
-gnunet-solver-eval
-gnunet-ats-sim
-perf_ats_proportional_core_bandwidth
-perf_ats_proportional_core_latency
-perf_ats_proportional_core_none
-perf_ats_proportional_transport_bandwidth
-perf_ats_proportional_transport_latency
-perf_ats_proportional_transport_none
-perf_ats_mlp_core_bandwidth
-perf_ats_mlp_core_latency
-perf_ats_mlp_core_none
-perf_ats_mlp_transport_bandwidth
-perf_ats_mlp_transport_latency
-perf_ats_mlp_transport_none
diff --git a/src/ats-tests/Makefile.am b/src/ats-tests/Makefile.am
deleted file mode 100644
index d515d3e17..000000000
--- a/src/ats-tests/Makefile.am
+++ /dev/null
@@ -1,170 +0,0 @@
-#t This Makefile.am is in the public domain
-AM_CPPFLAGS = -I$(top_srcdir)/src/include
-
-pkgcfgdir= $(pkgdatadir)/config.d/
-
-libexecdir= $(pkglibdir)/libexec/
-
-if USE_COVERAGE
- AM_CFLAGS = -fprofile-arcs -ftest-coverage
-endif
-
-if HAVE_TESTING
-TESTING_TESTS = \
- perf_ats_proportional_transport_none \
- perf_ats_proportional_transport_bandwidth \
- perf_ats_proportional_transport_latency \
- perf_ats_proportional_core_none \
- perf_ats_proportional_core_bandwidth \
- perf_ats_proportional_core_latency \
- $(PERF_MLP)
-
-endif
-
-lib_LTLIBRARIES = \
- libgnunetatstesting.la
-
-check_PROGRAMS = \
- $(TESTING_TESTS)
-
-if ENABLE_TEST_RUN
-AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset XDG_CONFIG_HOME;
-TESTS = $(check_PROGRAMS)
-endif
-
-noinst_PROGRAMS = \
- gnunet-ats-sim gnunet-solver-eval
-
-libgnunetatstesting_la_SOURCES = \
- ats-testing.c ats-testing.h \
- ats-testing-log.c ats-testing-traffic.c \
- ats-testing-experiment.c ats-testing-preferences.c
-libgnunetatstesting_la_LIBADD = \
- $(top_builddir)/src/testbed/libgnunettestbed.la \
- $(top_builddir)/src/testing/libgnunettesting.la \
- $(top_builddir)/src/statistics/libgnunetstatistics.la \
- $(top_builddir)/src/core/libgnunetcore.la \
- $(top_builddir)/src/transport/libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/ats/libgnunetats.la \
- $(top_builddir)/src/arm/libgnunetarm.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- $(GN_LIBINTL)
-libgnunetatstesting_la_DEPENDENCIES = \
- $(top_builddir)/src/testbed/libgnunettestbed.la \
- $(top_builddir)/src/ats/libgnunetats.la
-libgnunetatstesting_la_LDFLAGS = \
- $(GN_LIB_LDFLAGS)
-
-gnunet_ats_sim_SOURCES = \
- gnunet-ats-sim.c
-gnunet_ats_sim_LDADD = \
- $(top_builddir)/src/util/libgnunetutil.la \
- $(top_builddir)/src/ats-tests/libgnunetatstesting.la \
- $(top_builddir)/src/testing/libgnunettesting.la \
- $(top_builddir)/src/testbed/libgnunettestbed.la \
- $(top_builddir)/src/ats/libgnunetats.la \
- $(top_builddir)/src/core/libgnunetcore.la \
- $(top_builddir)/src/transport/libgnunettransport.la
-gnunet_ats_sim_DEPENDENCIES = \
- libgnunetatstesting.la \
- $(top_builddir)/src/util/libgnunetutil.la
-gnunet_ats_sim_LDFLAGS = \
- $(GN_LIBINTL)
-
-
-gnunet_solver_eval_SOURCES = \
- gnunet-solver-eval.c
-gnunet_solver_eval_LDADD = \
- $(top_builddir)/src/util/libgnunetutil.la \
- $(top_builddir)/src/ats/libgnunetats.la \
- $(top_builddir)/src/core/libgnunetcore.la \
- $(top_builddir)/src/transport/libgnunettransport.la
-gnunet_solver_eval_DEPENDENCIES = \
- $(top_builddir)/src/util/libgnunetutil.la
-gnunet_solver_eval_LDFLAGS = \
- $(GN_LIBINTL)
-
-perf_ats_proportional_core_none_SOURCES = \
- perf_ats.c
-perf_ats_proportional_core_none_LDADD = \
- $(top_builddir)/src/util/libgnunetutil.la \
- $(top_builddir)/src/ats-tests/libgnunetatstesting.la \
- $(top_builddir)/src/testbed/libgnunettestbed.la \
- $(top_builddir)/src/ats/libgnunetats.la \
- $(top_builddir)/src/core/libgnunetcore.la \
- $(top_builddir)/src/transport/libgnunettransport.la
-perf_ats_proportional_core_none_DEPENDENCIES = \
- libgnunetatstesting.la \
- $(top_builddir)/src/util/libgnunetutil.la
-
-perf_ats_proportional_transport_none_SOURCES = \
- perf_ats.c
-perf_ats_proportional_transport_none_LDADD = \
- $(top_builddir)/src/util/libgnunetutil.la \
- $(top_builddir)/src/ats-tests/libgnunetatstesting.la \
- $(top_builddir)/src/testbed/libgnunettestbed.la \
- $(top_builddir)/src/ats/libgnunetats.la \
- $(top_builddir)/src/core/libgnunetcore.la \
- $(top_builddir)/src/transport/libgnunettransport.la
-perf_ats_proportional_transport_none_DEPENDENCIES = \
- libgnunetatstesting.la \
- $(top_builddir)/src/util/libgnunetutil.la
-
-perf_ats_proportional_core_bandwidth_SOURCES = \
- perf_ats.c
-perf_ats_proportional_core_bandwidth_LDADD = \
- $(top_builddir)/src/util/libgnunetutil.la \
- $(top_builddir)/src/ats-tests/libgnunetatstesting.la \
- $(top_builddir)/src/testbed/libgnunettestbed.la \
- $(top_builddir)/src/ats/libgnunetats.la \
- $(top_builddir)/src/core/libgnunetcore.la \
- $(top_builddir)/src/transport/libgnunettransport.la
-perf_ats_proportional_core_bandwidth_DEPENDENCIES = \
- libgnunetatstesting.la \
- $(top_builddir)/src/util/libgnunetutil.la
-
-perf_ats_proportional_transport_bandwidth_SOURCES = \
- perf_ats.c
-perf_ats_proportional_transport_bandwidth_LDADD = \
- $(top_builddir)/src/util/libgnunetutil.la \
- $(top_builddir)/src/ats-tests/libgnunetatstesting.la \
- $(top_builddir)/src/testbed/libgnunettestbed.la \
- $(top_builddir)/src/ats/libgnunetats.la \
- $(top_builddir)/src/core/libgnunetcore.la \
- $(top_builddir)/src/transport/libgnunettransport.la
-perf_ats_proportional_transport_bandwidth_DEPENDENCIES = \
- libgnunetatstesting.la \
- $(top_builddir)/src/util/libgnunetutil.la
-
-perf_ats_proportional_core_latency_SOURCES = \
- perf_ats.c
-perf_ats_proportional_core_latency_LDADD = \
- $(top_builddir)/src/util/libgnunetutil.la \
- $(top_builddir)/src/ats-tests/libgnunetatstesting.la \
- $(top_builddir)/src/testbed/libgnunettestbed.la \
- $(top_builddir)/src/ats/libgnunetats.la \
- $(top_builddir)/src/core/libgnunetcore.la \
- $(top_builddir)/src/transport/libgnunettransport.la
-perf_ats_proportional_core_latency_DEPENDENCIES = \
- libgnunetatstesting.la \
- $(top_builddir)/src/util/libgnunetutil.la
-
-perf_ats_proportional_transport_latency_SOURCES = \
- perf_ats.c
-perf_ats_proportional_transport_latency_LDADD = \
- $(top_builddir)/src/util/libgnunetutil.la \
- $(top_builddir)/src/ats-tests/libgnunetatstesting.la \
- $(top_builddir)/src/testbed/libgnunettestbed.la \
- $(top_builddir)/src/ats/libgnunetats.la \
- $(top_builddir)/src/core/libgnunetcore.la \
- $(top_builddir)/src/transport/libgnunettransport.la
-perf_ats_proportional_transport_latency_DEPENDENCIES = \
- libgnunetatstesting.la \
- $(top_builddir)/src/util/libgnunetutil.la
-
-EXTRA_DIST = \
- gnunet_ats_sim_default.conf \
- perf_ats_proportional_none.conf \
- perf_ats_proportional_bandwidth.conf \
- perf_ats_proportional_latency.conf
diff --git a/src/ats-tests/ats-testing-experiment.c b/src/ats-tests/ats-testing-experiment.c
deleted file mode 100644
index 9f8db1be4..000000000
--- a/src/ats-tests/ats-testing-experiment.c
+++ /dev/null
@@ -1,820 +0,0 @@
-/*
- This file is part of GNUnet.
- Copyright (C) 2010-2013 GNUnet e.V.
-
- GNUnet is free software: you can redistribute it and/or modify it
- under the terms of the GNU Affero General Public License as published
- by the Free Software Foundation, either version 3 of the License,
- or (at your option) any later version.
-
- GNUnet is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-
- SPDX-License-Identifier: AGPL3.0-or-later
- */
-/**
- * @file ats-tests/ats-testing-experiment.c
- * @brief ats benchmark: controlled experiment execution
- * @author Christian Grothoff
- * @author Matthias Wachs
- */
-#include "platform.h"
-#include "gnunet_util_lib.h"
-#include "ats-testing.h"
-
-const char *
-print_op (enum OperationType op)
-{
- switch (op)
- {
- case START_SEND:
- return "START_SEND";
-
- case STOP_SEND:
- return "STOP_SEND";
-
- case START_PREFERENCE:
- return "START_PREFERENCE";
-
- case STOP_PREFERENCE:
- return "STOP_PREFERENCE";
-
- default:
- break;
- }
- return "";
-}
-
-
-static struct Experiment *
-create_experiment ()
-{
- struct Experiment *e;
-
- e = GNUNET_new (struct Experiment);
- e->name = NULL;
- e->num_masters = 0;
- e->num_slaves = 0;
- e->start = NULL;
- e->total_duration = GNUNET_TIME_UNIT_ZERO;
- return e;
-}
-
-
-static void
-free_experiment (struct Experiment *e)
-{
- struct Episode *cur;
- struct Episode *next;
- struct GNUNET_ATS_TEST_Operation *cur_o;
- struct GNUNET_ATS_TEST_Operation *next_o;
-
- next = e->start;
- for (cur = next; NULL != cur; cur = next)
- {
- next = cur->next;
-
- next_o = cur->head;
- for (cur_o = next_o; NULL != cur_o; cur_o = next_o)
- {
- next_o = cur_o->next;
- GNUNET_free (cur_o);
- }
- GNUNET_free (cur);
- }
-
- GNUNET_free (e->name);
- GNUNET_free (e->cfg_file);
- GNUNET_free (e);
-}
-
-
-static int
-load_episode (struct Experiment *e,
- struct Episode *cur,
- struct GNUNET_CONFIGURATION_Handle *cfg)
-{
- struct GNUNET_ATS_TEST_Operation *o;
- char *sec_name;
- char *op_name;
- char *op;
- char *type;
- char *pref;
- int op_counter = 0;
-
- fprintf (stderr, "Parsing episode %u\n", cur->id);
- GNUNET_asprintf (&sec_name, "episode-%u", cur->id);
-
- while (1)
- {
- /* Load operation */
- GNUNET_asprintf (&op_name, "op-%u-operation", op_counter);
- if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string (cfg,
- sec_name,
- op_name, &op))
- {
- GNUNET_free (op_name);
- break;
- }
- o = GNUNET_new (struct GNUNET_ATS_TEST_Operation);
- /* operations = set_rate, start_send, stop_send, set_preference */
- if (0 == strcmp (op, "start_send"))
- {
- o->type = START_SEND;
- }
- else if (0 == strcmp (op, "stop_send"))
- {
- o->type = STOP_SEND;
- }
- else if (0 == strcmp (op, "start_preference"))
- {
- o->type = START_PREFERENCE;
- }
- else if (0 == strcmp (op, "stop_preference"))
- {
- o->type = STOP_PREFERENCE;
- }
- else
- {
- fprintf (stderr, "Invalid operation %u `%s' in episode %u\n",
- op_counter, op, cur->id);
- GNUNET_free (op);
- GNUNET_free (op_name);
- GNUNET_free (o);
- GNUNET_free (sec_name);
- return GNUNET_SYSERR;
- }
- GNUNET_free (op_name);
-
- /* Get source */
- GNUNET_asprintf (&op_name, "op-%u-src", op_counter);
- if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg,
- sec_name,
- op_name,
- &o->src_id))
- {
- fprintf (stderr, "Missing src in operation %u `%s' in episode %u\n",
- op_counter, op, cur->id);
- GNUNET_free (op);
- GNUNET_free (op_name);
- GNUNET_free (o);
- GNUNET_free (sec_name);
- return GNUNET_SYSERR;
- }
- if (o->src_id > (e->num_masters - 1))
- {
- fprintf (stderr, "Invalid src %llu in operation %u `%s' in episode %u\n",
- o->src_id, op_counter, op, cur->id);
- GNUNET_free (op);
- GNUNET_free (op_name);
- GNUNET_free (o);
- GNUNET_free (sec_name);
- return GNUNET_SYSERR;
- }
- GNUNET_free (op_name);
-
- /* Get destination */
- GNUNET_asprintf (&op_name, "op-%u-dest", op_counter);
- if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg,
- sec_name,
- op_name,
- &o->dest_id))
- {
- fprintf (stderr, "Missing src in operation %u `%s' in episode %u\n",
- op_counter, op, cur->id);
- GNUNET_free (op);
- GNUNET_free (op_name);
- GNUNET_free (o);
- GNUNET_free (sec_name);
- return GNUNET_SYSERR;
- }
- if (o->dest_id > (e->num_slaves - 1))
- {
- fprintf (stderr,
- "Invalid destination %llu in operation %u `%s' in episode %u\n",
- o->dest_id, op_counter, op, cur->id);
- GNUNET_free (op);
- GNUNET_free (op_name);
- GNUNET_free (o);
- GNUNET_free (sec_name);
- return GNUNET_SYSERR;
- }
- GNUNET_free (op_name);
-
- GNUNET_asprintf (&op_name, "op-%u-type", op_counter);
- if ((GNUNET_SYSERR != GNUNET_CONFIGURATION_get_value_string (cfg,
- sec_name,
- op_name,
- &type)) &&
- (STOP_SEND != o->type) &&
- (STOP_PREFERENCE != o->type))
- {
- /* Load arguments for set_rate, start_send, set_preference */
- if (0 == strcmp (type, "constant"))
- {
- o->gen_type = GNUNET_ATS_TEST_TG_CONSTANT;
- }
- else if (0 == strcmp (type, "linear"))
- {
- o->gen_type = GNUNET_ATS_TEST_TG_LINEAR;
- }
- else if (0 == strcmp (type, "sinus"))
- {
- o->gen_type = GNUNET_ATS_TEST_TG_SINUS;
- }
- else if (0 == strcmp (type, "random"))
- {
- o->gen_type = GNUNET_ATS_TEST_TG_RANDOM;
- }
- else
- {
- fprintf (stderr, "Invalid type %u `%s' in episode %u\n",
- op_counter, op, cur->id);
- GNUNET_free (type);
- GNUNET_free (op);
- GNUNET_free (op_name);
- GNUNET_free (sec_name);
- GNUNET_free (o);
- return GNUNET_SYSERR;
- }
- GNUNET_free (op_name);
-
- /* Get base rate */
- GNUNET_asprintf (&op_name, "op-%u-base-rate", op_counter);
- if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg,
- sec_name,
- op_name,
- &o->base_rate))
- {
- fprintf (stderr,
- "Missing base rate in operation %u `%s' in episode %u\n",
- op_counter, op, cur->id);
- GNUNET_free (type);
- GNUNET_free (op);
- GNUNET_free (op_name);
- GNUNET_free (sec_name);
- GNUNET_free (o);
- return GNUNET_SYSERR;
- }
- GNUNET_free (op_name);
-
- /* Get max rate */
- GNUNET_asprintf (&op_name, "op-%u-max-rate", op_counter);
- if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg,
- sec_name,
- op_name,
- &o->max_rate))
- {
- if ((GNUNET_ATS_TEST_TG_LINEAR == o->gen_type) ||
- (GNUNET_ATS_TEST_TG_RANDOM == o->gen_type) ||
- (GNUNET_ATS_TEST_TG_SINUS == o->gen_type))
- {
- fprintf (stderr,
- "Missing max rate in operation %u `%s' in episode %u\n",
- op_counter, op, cur->id);
- GNUNET_free (type);
- GNUNET_free (op_name);
- GNUNET_free (op);
- GNUNET_free (o);
- GNUNET_free (sec_name);
- return GNUNET_SYSERR;
- }
- }
- GNUNET_free (op_name);
-
- /* Get period */
- GNUNET_asprintf (&op_name, "op-%u-period", op_counter);
- if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_time (cfg,
- sec_name,
- op_name,
- &o->period))
- {
- o->period = cur->duration;
- }
- GNUNET_free (op_name);
-
- if (START_PREFERENCE == o->type)
- {
- /* Get frequency */
- GNUNET_asprintf (&op_name, "op-%u-frequency", op_counter);
- if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_time (cfg,
- sec_name,
- op_name,
- &o->frequency))
- {
- fprintf (stderr,
- "Missing frequency in operation %u `%s' in episode %u\n",
- op_counter, op, cur->id);
- GNUNET_free (type);
- GNUNET_free (op_name);
- GNUNET_free (op);
- GNUNET_free (o);
- GNUNET_free (sec_name);
- return GNUNET_SYSERR;
- }
- GNUNET_free (op_name);
-
- /* Get preference */
- GNUNET_asprintf (&op_name, "op-%u-pref", op_counter);
- if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string (cfg,
- sec_name,
- op_name,
- &pref))
- {
- fprintf (stderr,
- "Missing preference in operation %u `%s' in episode %u\n",
- op_counter, op, cur->id);
- GNUNET_free (type);
- GNUNET_free (op_name);
- GNUNET_free (op);
- GNUNET_free (pref);
- GNUNET_free (o);
- GNUNET_free (sec_name);
- return GNUNET_SYSERR;
- }
-
- if (0 == strcmp (pref, "bandwidth"))
- o->pref_type = GNUNET_ATS_PREFERENCE_BANDWIDTH;
- else if (0 == strcmp (pref, "latency"))
- o->pref_type = GNUNET_ATS_PREFERENCE_LATENCY;
- else
- {
- fprintf (stderr,
- "Invalid preference in operation %u `%s' in episode %u\n",
- op_counter, op, cur->id);
- GNUNET_free (type);
- GNUNET_free (op_name);
- GNUNET_free (op);
- GNUNET_free (pref);
- GNUNET_free (o);
- GNUNET_free (sec_name);
- return GNUNET_SYSERR;
- }
- GNUNET_free (pref);
- GNUNET_free (op_name);
- }
- }
-
- /* Safety checks */
- if ((GNUNET_ATS_TEST_TG_LINEAR == o->gen_type) ||
- (GNUNET_ATS_TEST_TG_SINUS == o->gen_type))
- {
- if ((o->max_rate - o->base_rate) > o->base_rate)
- {
- /* This will cause an underflow */
- GNUNET_break (0);
- }
- fprintf (stderr,
- "Selected max rate and base rate cannot be used for desired traffic form!\n");
- }
-
- if ((START_SEND == o->type) || (START_PREFERENCE == o->type))
- fprintf (stderr,
- "Found operation %u in episode %u: %s [%llu]->[%llu] == %s, %llu -> %llu in %s\n",
- op_counter, cur->id, print_op (o->type), o->src_id,
- o->dest_id, (NULL != type) ? type : "",
- o->base_rate, o->max_rate,
- GNUNET_STRINGS_relative_time_to_string (o->period, GNUNET_YES));
- else
- fprintf (stderr, "Found operation %u in episode %u: %s [%llu]->[%llu]\n",
- op_counter, cur->id, print_op (o->type), o->src_id, o->dest_id);
-
- GNUNET_free (type);
- GNUNET_free (op);
-
- GNUNET_CONTAINER_DLL_insert (cur->head, cur->tail, o);
- op_counter++;
- }
- GNUNET_free (sec_name);
-
- return GNUNET_OK;
-}
-
-
-static int
-load_episodes (struct Experiment *e, struct GNUNET_CONFIGURATION_Handle *cfg)
-{
- int e_counter = 0;
- char *sec_name;
- struct GNUNET_TIME_Relative e_duration;
- struct Episode *cur;
- struct Episode *last;
-
- e_counter = 0;
- last = NULL;
- while (1)
- {
- GNUNET_asprintf (&sec_name, "episode-%u", e_counter);
- if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_time (cfg,
- sec_name,
- "duration",
- &e_duration))
- {
- GNUNET_free (sec_name);
- break;
- }
-
- cur = GNUNET_new (struct Episode);
- cur->duration = e_duration;
- cur->id = e_counter;
-
- if (GNUNET_OK != load_episode (e, cur, cfg))
- {
- GNUNET_free (sec_name);
- GNUNET_free (cur);
- return GNUNET_SYSERR;
- }
-
- fprintf (stderr, "Found episode %u with duration %s \n",
- e_counter,
- GNUNET_STRINGS_relative_time_to_string (cur->duration,
- GNUNET_YES));
-
- /* Update experiment */
- e->num_episodes++;
- e->total_duration = GNUNET_TIME_relative_add (e->total_duration,
- cur->duration);
- /* Put in linked list */
- if (NULL == last)
- e->start = cur;
- else
- last->next = cur;
-
- GNUNET_free (sec_name);
- e_counter++;
- last = cur;
- }
- return e_counter;
-}
-
-
-static void
-timeout_experiment (void *cls)
-{
- struct Experiment *e = cls;
-
- e->experiment_timeout_task = NULL;
- fprintf (stderr, "Experiment timeout!\n");
-
- if (NULL != e->episode_timeout_task)
- {
- GNUNET_SCHEDULER_cancel (e->episode_timeout_task);
- e->episode_timeout_task = NULL;
- }
-
- e->e_done_cb (e, GNUNET_TIME_absolute_get_duration (e->start_time),
- GNUNET_SYSERR);
-}
-
-
-static void
-enforce_start_send (struct GNUNET_ATS_TEST_Operation *op)
-{
- struct BenchmarkPeer *peer;
- struct BenchmarkPartner *partner;
-
- peer = GNUNET_ATS_TEST_get_peer (op->src_id);
- if (NULL == peer)
- {
- GNUNET_break (0);
- return;
- }
-
- partner = GNUNET_ATS_TEST_get_partner (op->src_id, op->dest_id);
- if (NULL == partner)
- {
- GNUNET_break (0);
- return;
- }
-
- fprintf (stderr, "Found master %llu slave %llu\n", op->src_id, op->dest_id);
-
- if (NULL != partner->tg)
- {
- fprintf (stderr, "Stopping traffic between master %llu slave %llu\n",
- op->src_id, op->dest_id);
- GNUNET_ATS_TEST_generate_traffic_stop (partner->tg);
- partner->tg = NULL;
- }
-
- partner->tg = GNUNET_ATS_TEST_generate_traffic_start (peer, partner,
- op->gen_type,
- op->base_rate,
- op->max_rate,
- op->period,
- GNUNET_TIME_UNIT_FOREVER_REL);
-}
-
-
-static void
-enforce_stop_send (struct GNUNET_ATS_TEST_Operation *op)
-{
- struct BenchmarkPartner *p;
-
- p = GNUNET_ATS_TEST_get_partner (op->src_id, op->dest_id);
- if (NULL == p)
- {
- GNUNET_break (0);
- return;
- }
-
- fprintf (stderr, "Found master %llu slave %llu\n", op->src_id, op->dest_id);
-
- if (NULL != p->tg)
- {
- fprintf (stderr, "Stopping traffic between master %llu slave %llu\n",
- op->src_id, op->dest_id);
- GNUNET_ATS_TEST_generate_traffic_stop (p->tg);
- p->tg = NULL;
- }
-}
-
-
-static void
-enforce_start_preference (struct GNUNET_ATS_TEST_Operation *op)
-{
- struct BenchmarkPeer *peer;
- struct BenchmarkPartner *partner;
-
- peer = GNUNET_ATS_TEST_get_peer (op->src_id);
- if (NULL == peer)
- {
- GNUNET_break (0);
- return;
- }
-
- partner = GNUNET_ATS_TEST_get_partner (op->src_id, op->dest_id);
- if (NULL == partner)
- {
- GNUNET_break (0);
- return;
- }
-
- fprintf (stderr, "Found master %llu slave %llu\n", op->src_id, op->dest_id);
-
- if (NULL != partner->pg)
- {
- fprintf (stderr, "Stopping traffic between master %llu slave %llu\n",
- op->src_id, op->dest_id);
- GNUNET_ATS_TEST_generate_preferences_stop (partner->pg);
- partner->pg = NULL;
- }
-
- partner->pg = GNUNET_ATS_TEST_generate_preferences_start (peer, partner,
- op->gen_type,
- op->base_rate,
- op->max_rate,
- op->period,
- op->frequency,
- op->pref_type);
-}
-
-
-static void
-enforce_stop_preference (struct GNUNET_ATS_TEST_Operation *op)
-{
- struct BenchmarkPartner *p;
-
- p = GNUNET_ATS_TEST_get_partner (op->src_id, op->dest_id);
- if (NULL == p)
- {
- GNUNET_break (0);
- return;
- }
-
- fprintf (stderr, "Found master %llu slave %llu\n", op->src_id, op->dest_id);
-
- if (NULL != p->pg)
- {
- fprintf (stderr, "Stopping preference between master %llu slave %llu\n",
- op->src_id, op->dest_id);
- GNUNET_ATS_TEST_generate_preferences_stop (p->pg);
- p->pg = NULL;
- }
-}
-
-
-static void
-enforce_episode (struct Episode *ep)
-{
- struct GNUNET_ATS_TEST_Operation *cur;
-
- for (cur = ep->head; NULL != cur; cur = cur->next)
- {
- fprintf (stderr, "Enforcing operation: %s [%llu]->[%llu] == %llu\n",
- print_op (cur->type), cur->src_id, cur->dest_id, cur->base_rate);
- switch (cur->type)
- {
- case START_SEND:
- enforce_start_send (cur);
- break;
-
- case STOP_SEND:
- enforce_stop_send (cur);
- break;
-
- case START_PREFERENCE:
- enforce_start_preference (cur);
- break;
-
- case STOP_PREFERENCE:
- enforce_stop_preference (cur);
- break;
-
- default:
- break;
- }
- }
-}
-
-
-static void
-timeout_episode (void *cls)
-{
- struct Experiment *e = cls;
-
- e->episode_timeout_task = NULL;
- if (NULL != e->ep_done_cb)
- e->ep_done_cb (e->cur);
-
- /* Scheduling next */
- e->cur = e->cur->next;
- if (NULL == e->cur)
- {
- /* done */
- fprintf (stderr, "Last episode done!\n");
- if (NULL != e->experiment_timeout_task)
- {
- GNUNET_SCHEDULER_cancel (e->experiment_timeout_task);
- e->experiment_timeout_task = NULL;
- }
- e->e_done_cb (e, GNUNET_TIME_absolute_get_duration (e->start_time),
- GNUNET_OK);
- return;
- }
-
- fprintf (stderr, "Running episode %u with timeout %s\n",
- e->cur->id,
- GNUNET_STRINGS_relative_time_to_string (e->cur->duration,
- GNUNET_YES));
- enforce_episode (e->cur);
-
- e->episode_timeout_task = GNUNET_SCHEDULER_add_delayed (e->cur->duration,
- &timeout_episode, e);
-}
-
-
-void
-GNUNET_ATS_TEST_experimentation_run (struct Experiment *e,
- GNUNET_ATS_TESTING_EpisodeDoneCallback
- ep_done_cb,
- GNUNET_ATS_TESTING_ExperimentDoneCallback
- e_done_cb)
-{
- fprintf (stderr, "Running experiment `%s' with timeout %s\n", e->name,
- GNUNET_STRINGS_relative_time_to_string (e->max_duration,
- GNUNET_YES));
- e->e_done_cb = e_done_cb;
- e->ep_done_cb = ep_done_cb;
- e->start_time = GNUNET_TIME_absolute_get ();
-
- /* Start total time out */
- e->experiment_timeout_task = GNUNET_SCHEDULER_add_delayed (e->max_duration,
- &timeout_experiment,
- e);
-
- /* Start */
- e->cur = e->start;
- fprintf (stderr, "Running episode %u with timeout %s\n",
- e->cur->id,
- GNUNET_STRINGS_relative_time_to_string (e->cur->duration,
- GNUNET_YES));
- enforce_episode (e->cur);
- e->episode_timeout_task = GNUNET_SCHEDULER_add_delayed (e->cur->duration,
- &timeout_episode, e);
-}
-
-
-struct Experiment *
-GNUNET_ATS_TEST_experimentation_load (const char *filename)
-{
- struct Experiment *e;
- struct GNUNET_CONFIGURATION_Handle *cfg;
-
- e = NULL;
-
- cfg = GNUNET_CONFIGURATION_create ();
- if (GNUNET_SYSERR == GNUNET_CONFIGURATION_load (cfg, filename))
- {
- fprintf (stderr, "Failed to load `%s'\n", filename);
- GNUNET_CONFIGURATION_destroy (cfg);
- return NULL;
- }
-
- e = create_experiment ();
-
- if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string (cfg, "experiment",
- "name", &e->name))
- {
- fprintf (stderr, "Invalid %s", "name");
- free_experiment (e);
- return NULL;
- }
- else
- fprintf (stderr, "Experiment name: `%s'\n", e->name);
-
- if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_filename (cfg,
- "experiment",
- "cfg_file",
- &e->cfg_file))
- {
- fprintf (stderr, "Invalid %s", "cfg_file");
- free_experiment (e);
- return NULL;
- }
- else
- fprintf (stderr, "Experiment name: `%s'\n", e->cfg_file);
-
- if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg, "experiment",
- "masters",
- &e->num_masters))
- {
- fprintf (stderr, "Invalid %s", "masters");
- free_experiment (e);
- return NULL;
- }
- else
- fprintf (stderr, "Experiment masters: `%llu'\n",
- e->num_masters);
-
- if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg, "experiment",
- "slaves",
- &e->num_slaves))
- {
- fprintf (stderr, "Invalid %s", "slaves");
- free_experiment (e);
- return NULL;
- }
- else
- fprintf (stderr, "Experiment slaves: `%llu'\n",
- e->num_slaves);
-
- if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_time (cfg, "experiment",
- "log_freq",
- &e->log_freq))
- {
- fprintf (stderr, "Invalid %s", "log_freq");
- free_experiment (e);
- return NULL;
- }
- else
- fprintf (stderr, "Experiment logging frequency: `%s'\n",
- GNUNET_STRINGS_relative_time_to_string (e->log_freq, GNUNET_YES));
-
- if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_time (cfg, "experiment",
- "max_duration",
- &e->max_duration))
- {
- fprintf (stderr, "Invalid %s", "max_duration");
- free_experiment (e);
- return NULL;
- }
- else
- fprintf (stderr, "Experiment duration: `%s'\n",
- GNUNET_STRINGS_relative_time_to_string (e->max_duration,
- GNUNET_YES));
-
- load_episodes (e, cfg);
- fprintf (stderr, "Loaded %u episodes with total duration %s\n",
- e->num_episodes,
- GNUNET_STRINGS_relative_time_to_string (e->total_duration,
- GNUNET_YES));
-
- GNUNET_CONFIGURATION_destroy (cfg);
- return e;
-}
-
-
-void
-GNUNET_ATS_TEST_experimentation_stop (struct Experiment *e)
-{
- if (NULL != e->experiment_timeout_task)
- {
- GNUNET_SCHEDULER_cancel (e->experiment_timeout_task);
- e->experiment_timeout_task = NULL;
- }
- if (NULL != e->episode_timeout_task)
- {
- GNUNET_SCHEDULER_cancel (e->episode_timeout_task);
- e->episode_timeout_task = NULL;
- }
- free_experiment (e);
-}
-
-
-/* end of file ats-testing-experiment.c*/
diff --git a/src/ats-tests/ats-testing-log.c b/src/ats-tests/ats-testing-log.c
deleted file mode 100644
index dfdfa8a80..000000000
--- a/src/ats-tests/ats-testing-log.c
+++ /dev/null
@@ -1,979 +0,0 @@
-/*
- This file is part of GNUnet.
- Copyright (C) 2010-2013 GNUnet e.V.
-
- GNUnet is free software: you can redistribute it and/or modify it
- under the terms of the GNU Affero General Public License as published
- by the Free Software Foundation, either version 3 of the License,
- or (at your option) any later version.
-
- GNUnet is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-
- SPDX-License-Identifier: AGPL3.0-or-later
- */
-/**
- * @file ats-tests/ats-testing-log.c
- * @brief ats benchmark: logging for performance tests
- * @author Christian Grothoff
- * @author Matthias Wachs
- */
-#include "platform.h"
-#include "gnunet_util_lib.h"
-#include "ats-testing.h"
-
-#define THROUGHPUT_TEMPLATE "#!/usr/bin/gnuplot \n" \
- "set datafile separator ';' \n" \
- "set title \"Throughput between Master and Slaves\" \n" \
- "set xlabel \"Time in ms\" \n" \
- "set ylabel \"Bytes/s\" \n" \
- "set grid \n"
-
-#define RTT_TEMPLATE "#!/usr/bin/gnuplot \n" \
- "set datafile separator ';' \n" \
- "set title \"Application level roundtrip time between Master and Slaves\" \n" \
- "set xlabel \"Time in ms\" \n" \
- "set ylabel \"ms\" \n" \
- "set grid \n"
-
-#define BW_TEMPLATE "#!/usr/bin/gnuplot \n" \
- "set datafile separator ';' \n" \
- "set title \"Bandwidth inbound and outbound between Master and Slaves\" \n" \
- "set xlabel \"Time in ms\" \n" \
- "set ylabel \"Bytes / s \" \n" \
- "set grid \n"
-
-#define LOG_ITEMS_TIME 2
-#define LOG_ITEMS_PER_PEER 17
-
-#define LOG_ITEM_BYTES_SENT 1
-#define LOG_ITEM_MSGS_SENT 2
-#define LOG_ITEM_THROUGHPUT_SENT 3
-#define LOG_ITEM_BYTES_RECV 4
-#define LOG_ITEM_MSGS_RECV 5
-#define LOG_ITEM_THROUGHPUT_RECV 6
-#define LOG_ITEM_APP_RTT 7
-#define LOG_ITEM_ATS_BW_IN 8
-#define LOG_ITEM_ATS_BW_OUT 9
-#define LOG_ITEM_ATS_COSTS_LAN 10
-#define LOG_ITEM_ATS_WAN 11
-#define LOG_ITEM_ATS_WLAN 12
-#define LOG_ITEM_ATS_DELAY 13
-#define LOG_ITEM_ATS_DISTANCE 14
-#define LOG_ITEM_ATS_NETWORKTYPE 15
-#define LOG_ITEM_ATS_UTIL_UP 16
-#define LOG_ITEM_ATS_UTIL_DOWN 17
-
-/**
- * A single logging time step for a partner
- */
-struct PartnerLoggingTimestep
-{
- /**
- * Peer
- */
- struct BenchmarkPeer *slave;
-
- /**
- * Total number of messages this peer has sent
- */
- unsigned int total_messages_sent;
-
- /**
- * Total number of bytes this peer has sent
- */
- unsigned int total_bytes_sent;
-
- /**
- * Total number of messages this peer has received
- */
- unsigned int total_messages_received;
-
- /**
- * Total number of bytes this peer has received
- */
- unsigned int total_bytes_received;
-
- /**
- * Total outbound throughput for master in Bytes / s
- */
- unsigned int throughput_sent;
-
- /**
- * Total inbound throughput for master in Bytes / s
- */
- unsigned int throughput_recv;
-
- /**
- * Accumulated RTT for all messages
- */
- unsigned int total_app_rtt;
-
- /**
- * Current application level delay
- */
- unsigned int app_rtt;
-
- /* Current ATS properties */
-
- unsigned int ats_distance;
-
- struct GNUNET_TIME_Relative ats_delay;
-
- uint32_t bandwidth_in;
-
- uint32_t bandwidth_out;
-
- uint32_t ats_utilization_out;
-
- uint32_t ats_utilization_in;
-
- enum GNUNET_NetworkType ats_network_type;
-
- double pref_bandwidth;
- double pref_delay;
-};
-
-
-/**
- * A single logging time step for a peer
- */
-struct PeerLoggingTimestep
-{
- /**
- * Next in DLL
- */
- struct PeerLoggingTimestep *next;
-
- /**
- * Prev in DLL
- */
- struct PeerLoggingTimestep *prev;
-
- /**
- * Logging timestamp
- */
- struct GNUNET_TIME_Absolute timestamp;
-
- /**
- * Total number of messages this peer has sent
- */
- unsigned int total_messages_sent;
-
- /**
- * Total number of bytes this peer has sent
- */
- unsigned int total_bytes_sent;
-
- /**
- * Total number of messages this peer has received
- */
- unsigned int total_messages_received;
-
- /**
- * Total number of bytes this peer has received
- */
- unsigned int total_bytes_received;
-
- /**
- * Total outbound throughput for master in Bytes / s
- */
- unsigned int total_throughput_send;
-
- /**
- * Total inbound throughput for master in Bytes / s
- */
- unsigned int total_throughput_recv;
-
- /**
- * Logs for slaves
- */
- struct PartnerLoggingTimestep *slaves_log;
-};
-
-/**
- * Entry for a benchmark peer
- */
-struct LoggingPeer
-{
- /**
- * Peer
- */
- struct BenchmarkPeer *peer;
-
- /**
- * Start time
- */
- struct GNUNET_TIME_Absolute start;
-
- /**
- * DLL for logging entries: head
- */
- struct PeerLoggingTimestep *head;
-
- /**
- * DLL for logging entries: tail
- */
- struct PeerLoggingTimestep *tail;
-};
-
-struct LoggingHandle
-{
- /**
- * Logging task
- */
- struct GNUNET_SCHEDULER_Task *log_task;
-
- /**
- * Reference to perf_ats' masters
- */
- int num_masters;
- int num_slaves;
- int running;
- int verbose;
- const char *name;
- struct GNUNET_TIME_Relative frequency;
-
- /**
- * Log structure of length num_peers
- */
- struct LoggingPeer *lp;
-};
-
-
-static void
-write_throughput_gnuplot_script (char *fn, struct LoggingPeer *lp, char **fs,
- int slaves)
-{
- struct GNUNET_DISK_FileHandle *f;
- char *gfn;
- char *data;
- int c_s;
-
- GNUNET_asprintf (&gfn, "gnuplot_throughput_%s", fn);
- fprintf (stderr,
- "Writing throughput plot for master %u and %u slaves to `%s'\n",
- lp->peer->no, slaves, gfn);
-
- f = GNUNET_DISK_file_open (gfn,
- GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_CREATE,
- GNUNET_DISK_PERM_USER_EXEC
- | GNUNET_DISK_PERM_USER_READ
- | GNUNET_DISK_PERM_USER_WRITE);
- if (NULL == f)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot open gnuplot file `%s'\n",
- gfn);
- GNUNET_free (gfn);
- return;
- }
-
- /* Write header */
- if (GNUNET_SYSERR == GNUNET_DISK_file_write (f, THROUGHPUT_TEMPLATE,
- strlen (THROUGHPUT_TEMPLATE)))
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Cannot write data to plot file `%s'\n", gfn);
-
- /* Write master data */
- GNUNET_asprintf (&data,
- "plot '%s' using 2:%u with lines title 'Master %u send total', \\\n" \
- "'%s' using 2:%u with lines title 'Master %u receive total', \\\n",
- fn, LOG_ITEMS_TIME + LOG_ITEM_THROUGHPUT_SENT, lp->peer->no,
- fn, LOG_ITEMS_TIME + LOG_ITEM_THROUGHPUT_RECV, lp->peer->no);
- if (GNUNET_SYSERR == GNUNET_DISK_file_write (f, data, strlen (data)))
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Cannot write data to plot file `%s'\n", gfn);
- GNUNET_free (data);
-
- for (c_s = 0; c_s < slaves; c_s++)
- {
- GNUNET_asprintf (&data,
- "'%s' using 2:%u with lines title 'Master %u - Slave %u send', \\\n" \
- "'%s' using 2:%u with lines title 'Master %u - Slave %u receive'%s\n",
- fs[c_s],
- LOG_ITEMS_TIME + LOG_ITEM_THROUGHPUT_SENT,
- lp->peer->no,
- lp->peer->partners[c_s].dest->no,
- fs[c_s],
- LOG_ITEMS_TIME + LOG_ITEM_THROUGHPUT_RECV,
- lp->peer->no,
- lp->peer->partners[c_s].dest->no,
- (c_s < lp->peer->num_partners - 1) ? ", \\" :
- "\n pause -1");
- if (GNUNET_SYSERR == GNUNET_DISK_file_write (f, data, strlen (data)))
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Cannot write data to plot file `%s'\n", gfn);
- GNUNET_free (data);
- }
-
- if (GNUNET_SYSERR == GNUNET_DISK_file_close (f))
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Cannot close gnuplot file `%s'\n", gfn);
- else
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Data successfully written to plot file `%s'\n", gfn);
- GNUNET_free (gfn);
-}
-
-
-static void
-write_rtt_gnuplot_script (char *fn, struct LoggingPeer *lp, char **fs, int
- slaves)
-{
- struct GNUNET_DISK_FileHandle *f;
- char *gfn;
- char *data;
- int c_s;
-
- GNUNET_asprintf (&gfn, "gnuplot_rtt_%s", fn);
- fprintf (stderr, "Writing rtt plot for master %u to `%s'\n",
- lp->peer->no, gfn);
-
- f = GNUNET_DISK_file_open (gfn,
- GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_CREATE,
- GNUNET_DISK_PERM_USER_EXEC
- | GNUNET_DISK_PERM_USER_READ
- | GNUNET_DISK_PERM_USER_WRITE);
- if (NULL == f)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot open gnuplot file `%s'\n",
- gfn);
- GNUNET_free (gfn);
- return;
- }
-
- /* Write header */
- if (GNUNET_SYSERR == GNUNET_DISK_file_write (f, RTT_TEMPLATE, strlen (
- RTT_TEMPLATE)))
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Cannot write data to plot file `%s'\n", gfn);
-
- for (c_s = 0; c_s < slaves; c_s++)
- {
- GNUNET_asprintf (&data,
- "%s'%s' using 2:%u with lines title 'Master %u - Slave %u '%s\n",
- (0 == c_s) ? "plot " : "",
- fs[c_s],
- LOG_ITEMS_TIME + LOG_ITEM_APP_RTT,
- lp->peer->no,
- lp->peer->partners[c_s].dest->no,
- (c_s < lp->peer->num_partners - 1) ? ", \\" :
- "\n pause -1");
- if (GNUNET_SYSERR == GNUNET_DISK_file_write (f, data, strlen (data)))
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Cannot write data to plot file `%s'\n", gfn);
- GNUNET_free (data);
- }
-
- if (GNUNET_SYSERR == GNUNET_DISK_file_close (f))
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot close gnuplot file `%s'\n",
- gfn);
- else
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Data successfully written to plot file `%s'\n", gfn);
- GNUNET_free (gfn);
-}
-
-
-static void
-write_bw_gnuplot_script (char *fn, struct LoggingPeer *lp, char **fs, int
- slaves)
-{
- struct GNUNET_DISK_FileHandle *f;
- char *gfn;
- char *data;
- int c_s;
-
- GNUNET_asprintf (&gfn, "gnuplot_bw_%s", fn);
- fprintf (stderr, "Writing bandwidth plot for master %u to `%s'\n",
- lp->peer->no, gfn);
-
- f = GNUNET_DISK_file_open (gfn,
- GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_CREATE,
- GNUNET_DISK_PERM_USER_EXEC
- | GNUNET_DISK_PERM_USER_READ
- | GNUNET_DISK_PERM_USER_WRITE);
- if (NULL == f)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot open gnuplot file `%s'\n",
- gfn);
- GNUNET_free (gfn);
- return;
- }
-
- /* Write header */
- if (GNUNET_SYSERR == GNUNET_DISK_file_write (f, BW_TEMPLATE, strlen (
- BW_TEMPLATE)))
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Cannot write data to plot file `%s'\n", gfn);
-
- for (c_s = 0; c_s < slaves; c_s++)
- {
- GNUNET_asprintf (&data, "%s" \
- "'%s' using 2:%u with lines title 'BW out master %u - Slave %u ', \\\n" \
- "'%s' using 2:%u with lines title 'BW in master %u - Slave %u '" \
- "%s\n",
- (0 == c_s) ? "plot " : "",
- fs[c_s],
- LOG_ITEMS_TIME + LOG_ITEM_ATS_BW_OUT,
- lp->peer->no, c_s,
- fs[c_s],
- LOG_ITEMS_TIME + LOG_ITEM_ATS_BW_IN,
- lp->peer->no, c_s,
- (c_s < lp->peer->num_partners - 1) ? ", \\" :
- "\n pause -1");
- if (GNUNET_SYSERR == GNUNET_DISK_file_write (f, data, strlen (data)))
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Cannot write data to plot file `%s'\n", gfn);
- GNUNET_free (data);
- }
-
- if (GNUNET_SYSERR == GNUNET_DISK_file_close (f))
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot close gnuplot file `%s'\n",
- gfn);
- else
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Data successfully written to plot file `%s'\n", gfn);
- GNUNET_free (gfn);
-}
-
-
-void
-GNUNET_ATS_TEST_logging_write_to_file (struct LoggingHandle *l,
- const char *experiment_name,
- int plots)
-{
- struct GNUNET_DISK_FileHandle *f[l->num_slaves];
- struct GNUNET_DISK_FileHandle *f_m;
- const char *tmp_exp_name;
- char *filename_master;
- char *filename_slaves[l->num_slaves];
- char *data;
- struct PeerLoggingTimestep *cur_lt;
- struct PartnerLoggingTimestep *plt;
- struct GNUNET_TIME_Absolute timestamp;
- int c_m;
- int c_s;
-
-
- timestamp = GNUNET_TIME_absolute_get ();
-
- tmp_exp_name = experiment_name;
- for (c_m = 0; c_m < l->num_masters; c_m++)
- {
- GNUNET_asprintf (&filename_master, "%s_%llu_master%u_%s",
- experiment_name,
- (unsigned long long) timestamp.abs_value_us, c_m, l->name);
- fprintf (stderr, "Writing data for master %u to file `%s'\n",
- c_m, filename_master);
-
- f_m = GNUNET_DISK_file_open (filename_master,
- GNUNET_DISK_OPEN_WRITE
- | GNUNET_DISK_OPEN_CREATE,
- GNUNET_DISK_PERM_USER_READ
- | GNUNET_DISK_PERM_USER_WRITE);
- if (NULL == f_m)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot open log file `%s'\n",
- filename_master);
- GNUNET_free (filename_master);
- return;
- }
-
- GNUNET_asprintf (&data, "# master %u; experiment : %s\n"
- "timestamp; timestamp delta; #messages sent; #bytes sent; #throughput sent; #messages received; #bytes received; #throughput received; \n",
- c_m, experiment_name);
- if (GNUNET_SYSERR == GNUNET_DISK_file_write (f_m, data, strlen (data)))
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Cannot write data to log file `%s'\n", filename_master);
- GNUNET_free (data);
-
- for (c_s = 0; c_s < l->lp[c_m].peer->num_partners; c_s++)
- {
- GNUNET_asprintf (&filename_slaves[c_s], "%s_%llu_master%u_slave_%u_%s",
- tmp_exp_name,
- (unsigned long long) timestamp.abs_value_us,
- c_m, c_s, l->name);
-
- fprintf (stderr, "Writing data for master %u slave %u to file `%s'\n",
- c_m, c_s, filename_slaves[c_s]);
-
- f[c_s] = GNUNET_DISK_file_open (filename_slaves[c_s],
- GNUNET_DISK_OPEN_WRITE
- | GNUNET_DISK_OPEN_CREATE,
- GNUNET_DISK_PERM_USER_READ
- | GNUNET_DISK_PERM_USER_WRITE);
- if (NULL == f[c_s])
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot open log file `%s'\n",
- filename_slaves[c_s]);
- GNUNET_free (filename_slaves[c_s]);
- GNUNET_break (GNUNET_OK == GNUNET_DISK_file_close (f_m));
- GNUNET_free (filename_master);
- return;
- }
-
- /* Header */
- GNUNET_asprintf (&data, "# master %u; slave %u ; experiment : %s\n"
- "timestamp; timestamp delta; #messages sent; #bytes sent; #throughput sent; #messages received; #bytes received; #throughput received; " \
- "rtt; bw in; bw out; ats_cost_lan; ats_cost_wlan; ats_delay; ats_distance; ats_network_type; ats_utilization_up ;ats_utilization_down;" \
- "pref bandwidth; pref delay\n",
- c_m, c_s, experiment_name);
- if (GNUNET_SYSERR == GNUNET_DISK_file_write (f[c_s], data, strlen (data)))
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Cannot write data to log file `%s'\n",
- filename_slaves[c_s]);
- GNUNET_free (data);
- }
-
- for (cur_lt = l->lp[c_m].head; NULL != cur_lt; cur_lt = cur_lt->next)
- {
- if (l->verbose)
- fprintf (stderr,
- "Master [%u]: timestamp %llu %llu ; %u %u %u ; %u %u %u\n",
- l->lp[c_m].peer->no,
- (long long unsigned int) cur_lt->timestamp.abs_value_us,
- (long long unsigned int) GNUNET_TIME_absolute_get_difference (
- l->lp[c_m].start,
- cur_lt
- ->timestamp).rel_value_us / 1000,
- cur_lt->total_messages_sent,
- cur_lt->total_bytes_sent,
- cur_lt->total_throughput_send,
- cur_lt->total_messages_received,
- cur_lt->total_bytes_received,
- cur_lt->total_throughput_recv);
-
- /* Assembling master string */
- GNUNET_asprintf (&data, "%llu;%llu;%u;%u;%u;%u;%u;%u;\n",
- (long long unsigned int) cur_lt->timestamp.abs_value_us,
- (long long unsigned
- int) GNUNET_TIME_absolute_get_difference (
- l->lp[c_m].start,
- cur_lt
- ->timestamp).
- rel_value_us / 1000,
- cur_lt->total_messages_sent,
- cur_lt->total_bytes_sent,
- cur_lt->total_throughput_send,
- cur_lt->total_messages_received,
- cur_lt->total_bytes_received,
- cur_lt->total_throughput_recv);
-
- if (GNUNET_SYSERR == GNUNET_DISK_file_write (f_m, data, strlen (data)))
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Cannot write data to master file %u\n", c_m);
- GNUNET_free (data);
-
-
- for (c_s = 0; c_s < l->lp[c_m].peer->num_partners; c_s++)
- {
- plt = &cur_lt->slaves_log[c_s];
- /* Log partners */
-
- /* Assembling slave string */
- GNUNET_asprintf (&data,
- "%llu;%llu;%u;%u;%u;%u;%u;%u;%.3f;%u;%u;%llu;%u;%u;%u;%u;%.3f;%.3f\n",
- (long long unsigned
- int) cur_lt->timestamp.abs_value_us,
- (long long unsigned
- int) GNUNET_TIME_absolute_get_difference (
- l->lp[c_m].start,
- cur_lt
- ->timestamp)
- .rel_value_us / 1000,
- plt->total_messages_sent,
- plt->total_bytes_sent,
- plt->throughput_sent,
- plt->total_messages_received,
- plt->total_bytes_received,
- plt->throughput_recv,
- (double) plt->app_rtt / 1000,
- plt->bandwidth_in,
- plt->bandwidth_out,
- (unsigned long long) plt->ats_delay.rel_value_us,
- plt->ats_distance,
- plt->ats_network_type,
- plt->ats_utilization_out,
- plt->ats_utilization_in,
- plt->pref_bandwidth,
- plt->pref_delay);
-
- if (l->verbose)
- fprintf (stderr,
- "\t Slave [%u]: %u %u %u ; %u %u %u rtt %u delay %llu bw_in %u bw_out %u \n",
- plt->slave->no,
- plt->total_messages_sent,
- plt->total_bytes_sent,
- plt->throughput_sent,
- plt->total_messages_received,
- plt->total_bytes_received,
- plt->throughput_recv,
- plt->app_rtt,
- (long long unsigned int) plt->ats_delay.rel_value_us,
- plt->bandwidth_in,
- plt->bandwidth_out);
-
- if (GNUNET_SYSERR == GNUNET_DISK_file_write (f[c_s], data, strlen (
- data)))
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Cannot write data to log file `%s'\n",
- filename_slaves[c_s]);
- GNUNET_free (data);
- }
- }
-
- for (c_s = 0; c_s < l->lp[c_m].peer->num_partners; c_s++)
- {
- if (GNUNET_SYSERR == GNUNET_DISK_file_close (f[c_s]))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Cannot close log file for master[%u] slave[%u]\n", c_m,
- c_s);
- continue;
- }
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Data file successfully written to log file for `%s'\n",
- filename_slaves[c_s]);
- }
-
- if (GNUNET_SYSERR == GNUNET_DISK_file_close (f_m))
- {
- GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR,
- "close",
- filename_master);
- GNUNET_free (filename_master);
- return;
- }
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Data file successfully written to log file for master `%s'\n",
- filename_master);
-
- if (GNUNET_YES == plots)
- {
- write_throughput_gnuplot_script (filename_master, &l->lp[c_m],
- filename_slaves, l->num_slaves);
- write_rtt_gnuplot_script (filename_master, &l->lp[c_m], filename_slaves,
- l->num_slaves);
- write_bw_gnuplot_script (filename_master, &l->lp[c_m], filename_slaves,
- l->num_slaves);
- }
- }
- GNUNET_free (filename_master);
-}
-
-
-/**
- * Log all data now
- *
- * @param l logging handle to use
- */
-void
-GNUNET_ATS_TEST_logging_now (struct LoggingHandle *l)
-{
- struct LoggingPeer *bp;
- struct PeerLoggingTimestep *mlt;
- struct PeerLoggingTimestep *prev_log_mlt;
- struct PartnerLoggingTimestep *slt;
- struct PartnerLoggingTimestep *prev_log_slt;
- struct BenchmarkPartner *p;
- struct GNUNET_TIME_Relative delta;
- int c_s;
- int c_m;
- unsigned int app_rtt;
- double mult;
-
- if (GNUNET_YES != l->running)
- return;
-
- for (c_m = 0; c_m < l->num_masters; c_m++)
- {
- bp = &l->lp[c_m];
- mlt = GNUNET_new (struct PeerLoggingTimestep);
- GNUNET_CONTAINER_DLL_insert_tail (l->lp[c_m].head, l->lp[c_m].tail, mlt);
- prev_log_mlt = mlt->prev;
-
- /* Collect data */
- /* Current master state */
- mlt->timestamp = GNUNET_TIME_absolute_get ();
- mlt->total_bytes_sent = bp->peer->total_bytes_sent;
- mlt->total_messages_sent = bp->peer->total_messages_sent;
- mlt->total_bytes_received = bp->peer->total_bytes_received;
- mlt->total_messages_received = bp->peer->total_messages_received;
-
- /* Throughput */
- if (NULL == prev_log_mlt)
- {
- /* Get difference to start */
- delta = GNUNET_TIME_absolute_get_difference (l->lp[c_m].start,
- mlt->timestamp);
- }
- else
- {
- /* Get difference to last timestep */
- delta = GNUNET_TIME_absolute_get_difference (mlt->prev->timestamp,
- mlt->timestamp);
- }
-
- /* Multiplication factor for throughput calculation */
- mult = (double) GNUNET_TIME_UNIT_SECONDS.rel_value_us
- / (delta.rel_value_us);
-
- /* Total throughput */
- if (NULL != prev_log_mlt)
- {
- if (mlt->total_bytes_sent - mlt->prev->total_bytes_sent > 0)
- {
- mlt->total_throughput_send = mult * (mlt->total_bytes_sent
- - mlt->prev->total_bytes_sent);
- }
- else
- {
- mlt->total_throughput_send = 0;
- // mlt->total_throughput_send = prev_log_mlt->total_throughput_send; /* no msgs send */
- }
-
- if (mlt->total_bytes_received - mlt->prev->total_bytes_received > 0)
- {
- mlt->total_throughput_recv = mult * (mlt->total_bytes_received
- - mlt->prev->total_bytes_received);
- }
- else
- {
- mlt->total_throughput_recv = 0;
- // mlt->total_throughput_recv = prev_log_mlt->total_throughput_recv; /* no msgs received */
- }
- }
- else
- {
- mlt->total_throughput_send = mult * mlt->total_bytes_sent;
- mlt->total_throughput_recv = mult * mlt->total_bytes_received;
- }
-
- if (GNUNET_YES == l->verbose)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Master[%u] delta: %llu us, bytes (sent/received): %u / %u; throughput send/recv: %u / %u\n",
- c_m,
- (unsigned long long) delta.rel_value_us,
- mlt->total_bytes_sent,
- mlt->total_bytes_received,
- mlt->total_throughput_send,
- mlt->total_throughput_recv);
- }
-
- mlt->slaves_log = GNUNET_malloc (bp->peer->num_partners
- * sizeof(struct PartnerLoggingTimestep));
-
- for (c_s = 0; c_s < bp->peer->num_partners; c_s++)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Collect logging data master[%u] slave [%u]\n", c_m, c_s);
-
- p = &bp->peer->partners[c_s];
- slt = &mlt->slaves_log[c_s];
-
- slt->slave = p->dest;
- /* Bytes sent from master to this slave */
- slt->total_bytes_sent = p->bytes_sent;
- /* Messages sent from master to this slave */
- slt->total_messages_sent = p->messages_sent;
- /* Bytes master received from this slave */
- slt->total_bytes_received = p->bytes_received;
- /* Messages master received from this slave */
- slt->total_messages_received = p->messages_received;
- slt->total_app_rtt = p->total_app_rtt;
- /* ats performance information */
- slt->ats_delay = p->props.delay;
- slt->ats_distance = p->props.distance;
- slt->ats_network_type = p->props.scope;
- slt->ats_utilization_in = p->props.utilization_out;
- slt->ats_utilization_out = p->props.utilization_out;
- slt->bandwidth_in = p->bandwidth_in;
- slt->bandwidth_out = p->bandwidth_out;
- slt->pref_bandwidth = p->pref_bandwidth;
- slt->pref_delay = p->pref_delay;
-
- /* Total application level rtt */
- if (NULL == prev_log_mlt)
- {
- if (0 != slt->total_messages_sent)
- app_rtt = slt->total_app_rtt / slt->total_messages_sent;
- else
- app_rtt = 0;
- }
- else
- {
- prev_log_slt = &prev_log_mlt->slaves_log[c_s];
- if ((slt->total_messages_sent - prev_log_slt->total_messages_sent) > 0)
- app_rtt = (slt->total_app_rtt - prev_log_slt->total_app_rtt)
- / (slt->total_messages_sent
- - prev_log_slt->total_messages_sent);
- else
- {
- app_rtt = prev_log_slt->app_rtt; /* No messages were */
- }
- }
- slt->app_rtt = app_rtt;
-
- /* Partner throughput */
- if (NULL != prev_log_mlt)
- {
- prev_log_slt = &prev_log_mlt->slaves_log[c_s];
- if (slt->total_bytes_sent > prev_log_slt->total_bytes_sent)
- slt->throughput_sent = mult * (slt->total_bytes_sent
- - prev_log_slt->total_bytes_sent);
- else
- slt->throughput_sent = 0;
-
- if (slt->total_bytes_received > prev_log_slt->total_bytes_received)
- slt->throughput_recv = mult
- * (slt->total_bytes_received
- - prev_log_slt->total_bytes_received);
- else
- slt->throughput_recv = 0;
- }
- else
- {
- slt->throughput_sent = mult * slt->total_bytes_sent;
- slt->throughput_recv = mult * slt->total_bytes_received;
- }
-
- if (GNUNET_YES == l->verbose)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Master [%u] -> Slave [%u]: delta: %llu us, bytes (sent/received): %u / %u; throughput send/recv: %u / %u\n",
- c_m, c_s,
- (unsigned long long) delta.rel_value_us,
- mlt->total_bytes_sent,
- mlt->total_bytes_received,
- slt->throughput_sent,
- slt->throughput_recv);
- }
- else
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Master [%u]: slave [%u]\n",
- bp->peer->no, p->dest->no);
- }
- }
-}
-
-
-static void
-collect_log_task (void *cls)
-{
- struct LoggingHandle *l = cls;
-
- l->log_task = NULL;
- GNUNET_ATS_TEST_logging_now (l);
- l->log_task = GNUNET_SCHEDULER_add_delayed (l->frequency,
- &collect_log_task,
- l);
-}
-
-
-/**
- * Stop logging
- *
- * @param l the logging handle
- */
-void
-GNUNET_ATS_TEST_logging_stop (struct LoggingHandle *l)
-{
- if (GNUNET_YES != l->running)
- return;
-
- if (NULL != l->log_task)
- {
- GNUNET_SCHEDULER_cancel (l->log_task);
- l->log_task = NULL;
- }
- l->running = GNUNET_NO;
-
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- _ ("Stop logging\n"));
-}
-
-
-/**
- * Clean up logging data
- *
- * @param l the logging handle
- */
-void
-GNUNET_ATS_TEST_logging_clean_up (struct LoggingHandle *l)
-{
- int c_m;
- struct PeerLoggingTimestep *cur;
-
- if (GNUNET_YES == l->running)
- GNUNET_ATS_TEST_logging_stop (l);
-
- for (c_m = 0; c_m < l->num_masters; c_m++)
- {
- while (NULL != (cur = l->lp[c_m].head))
- {
- GNUNET_CONTAINER_DLL_remove (l->lp[c_m].head, l->lp[c_m].tail, cur);
- GNUNET_free (cur->slaves_log);
- GNUNET_free (cur);
- }
- }
-
- GNUNET_free (l->lp);
- GNUNET_free (l);
-}
-
-
-/**
- * Start logging
- *
- * @param log_frequency the logging frequency
- * @param testname the testname
- * @param masters the master peers used for benchmarking
- * @param num_masters the number of master peers
- * @param num_slaves the number of slave peers
- * @param verbose verbose logging
- * @return the logging handle or NULL on error
- */
-struct LoggingHandle *
-GNUNET_ATS_TEST_logging_start (struct GNUNET_TIME_Relative log_frequency,
- const char *testname,
- struct BenchmarkPeer *masters,
- int num_masters,
- int num_slaves,
- int verbose)
-{
- struct LoggingHandle *l;
- int c_m;
-
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- _ ("Start logging `%s'\n"), testname);
-
- l = GNUNET_new (struct LoggingHandle);
- l->num_masters = num_masters;
- l->num_slaves = num_slaves;
- l->name = testname;
- l->frequency = log_frequency;
- l->verbose = verbose;
- l->lp = GNUNET_malloc (num_masters * sizeof(struct LoggingPeer));
-
- for (c_m = 0; c_m < num_masters; c_m++)
- {
- l->lp[c_m].peer = &masters[c_m];
- l->lp[c_m].start = GNUNET_TIME_absolute_get ();
- }
-
- /* Schedule logging task */
- l->log_task = GNUNET_SCHEDULER_add_now (&collect_log_task, l);
- l->running = GNUNET_YES;
-
- return l;
-}
-
-
-/* end of file ats-testing-log.c */
diff --git a/src/ats-tests/ats-testing-preferences.c b/src/ats-tests/ats-testing-preferences.c
deleted file mode 100644
index f30fde960..000000000
--- a/src/ats-tests/ats-testing-preferences.c
+++ /dev/null
@@ -1,265 +0,0 @@
-/*
- This file is part of GNUnet.
- Copyright (C) 2010-2013 GNUnet e.V.
-
- GNUnet is free software: you can redistribute it and/or modify it
- under the terms of the GNU Affero General Public License as published
- by the Free Software Foundation, either version 3 of the License,
- or (at your option) any later version.
-
- GNUnet is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-
- SPDX-License-Identifier: AGPL3.0-or-later
- */
-/**
- * @file ats-tests/ats-testing-preferences.c
- * @brief ats benchmark: preference generator
- * @author Christian Grothoff
- * @author Matthias Wachs
- */
-#include "platform.h"
-#include "gnunet_util_lib.h"
-#include "ats-testing.h"
-
-static struct PreferenceGenerator *pg_head;
-static struct PreferenceGenerator *pg_tail;
-
-extern struct GNUNET_ATS_TEST_Topology *top;
-
-static double
-get_preference (struct PreferenceGenerator *pg)
-{
- struct GNUNET_TIME_Relative time_delta;
- double delta_value;
- double pref_value;
-
- /* Calculate the current preference value */
- switch (pg->type)
- {
- case GNUNET_ATS_TEST_TG_CONSTANT:
- pref_value = pg->base_value;
- break;
-
- case GNUNET_ATS_TEST_TG_LINEAR:
- time_delta = GNUNET_TIME_absolute_get_duration (pg->time_start);
- /* Calculate point of time in the current period */
- time_delta.rel_value_us = time_delta.rel_value_us
- % pg->duration_period.rel_value_us;
- delta_value = ((double) time_delta.rel_value_us
- / pg->duration_period.rel_value_us) * (pg->max_value
- - pg->base_value);
- if ((pg->max_value < pg->base_value) &&
- ((pg->max_value - pg->base_value) > pg->base_value))
- {
- /* This will cause an underflow */
- GNUNET_break (0);
- }
- pref_value = pg->base_value + delta_value;
- break;
-
- case GNUNET_ATS_TEST_TG_RANDOM:
- delta_value = (double) GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
- 10000 * (pg->max_value
- - pg->base_value))
- / 10000;
- pref_value = pg->base_value + delta_value;
- break;
-
- case GNUNET_ATS_TEST_TG_SINUS:
- time_delta = GNUNET_TIME_absolute_get_duration (pg->time_start);
- /* Calculate point of time in the current period */
- time_delta.rel_value_us = time_delta.rel_value_us
- % pg->duration_period.rel_value_us;
- if ((pg->max_value - pg->base_value) > pg->base_value)
- {
- /* This will cause an underflow for second half of sinus period,
- * will be detected in general when experiments are loaded */
- GNUNET_break (0);
- }
- delta_value = (pg->max_value - pg->base_value)
- * sin ((2 * M_PI)
- / ((double) pg->duration_period.rel_value_us)
- * time_delta.rel_value_us);
- pref_value = pg->base_value + delta_value;
- break;
-
- default:
- pref_value = 0.0;
- break;
- }
- GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Current preference value is %f\n",
- pref_value);
- return pref_value;
-}
-
-
-static void
-set_pref_task (void *cls)
-{
- struct BenchmarkPartner *p = cls;
- double pref_value;
-
- p->pg->set_task = NULL;
-
- pref_value = get_preference (p->pg);
-
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Setting preference for master [%u] and slave [%u] for %s to %f\n",
- p->me->no, p->dest->no,
- GNUNET_ATS_print_preference_type (p->pg->kind), pref_value);
-
- GNUNET_ATS_performance_change_preference (p->me->ats_perf_handle,
- &p->dest->id,
- p->pg->kind,
- pref_value,
- GNUNET_ATS_PREFERENCE_END);
-
- switch (p->pg->kind)
- {
- case GNUNET_ATS_PREFERENCE_BANDWIDTH:
- p->pref_bandwidth = pref_value;
- break;
-
- case GNUNET_ATS_PREFERENCE_LATENCY:
- p->pref_delay = pref_value;
- break;
-
- default:
- break;
- }
-
- p->pg->set_task = GNUNET_SCHEDULER_add_delayed (p->pg->frequency,
- set_pref_task, p);
-}
-
-
-/**
- * Generate between the source master and the partner and set preferences with a
- * value depending on the generator.
- *
- * @param src source
- * @param dest partner
- * @param type type of preferences to generate
- * @param base_value traffic base rate to send data with
- * @param value_rate traffic maximum rate to send data with
- * @param period duration of a period of preferences generation (~ 1/frequency)
- * @param frequency how long to generate preferences
- * @param kind ATS preference to generate
- * @return the preference generator
- */
-struct PreferenceGenerator *
-GNUNET_ATS_TEST_generate_preferences_start (struct BenchmarkPeer *src,
- struct BenchmarkPartner *dest,
- enum GeneratorType type,
- unsigned int base_value,
- unsigned int value_rate,
- struct GNUNET_TIME_Relative period,
- struct GNUNET_TIME_Relative
- frequency,
- enum GNUNET_ATS_PreferenceKind kind)
-{
- struct PreferenceGenerator *pg;
-
- if (NULL != dest->pg)
- {
- GNUNET_break (0);
- return NULL;
- }
-
- pg = GNUNET_new (struct PreferenceGenerator);
- GNUNET_CONTAINER_DLL_insert (pg_head, pg_tail, pg);
- pg->type = type;
- pg->src = src;
- pg->dest = dest;
- pg->kind = kind;
- pg->base_value = base_value;
- pg->max_value = value_rate;
- pg->duration_period = period;
- pg->frequency = frequency;
- pg->time_start = GNUNET_TIME_absolute_get ();
-
- switch (type)
- {
- case GNUNET_ATS_TEST_TG_CONSTANT:
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Setting up constant preference generator master[%u] `%s' and slave [%u] `%s' max %u Bips\n",
- dest->me->no, GNUNET_i2s (&dest->me->id),
- dest->dest->no, GNUNET_i2s (&dest->dest->id),
- base_value);
- break;
-
- case GNUNET_ATS_TEST_TG_LINEAR:
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Setting up linear preference generator master[%u] `%s' and slave [%u] `%s' min %u Bips max %u Bips\n",
- dest->me->no, GNUNET_i2s (&dest->me->id),
- dest->dest->no, GNUNET_i2s (&dest->dest->id),
- base_value, value_rate);
- break;
-
- case GNUNET_ATS_TEST_TG_SINUS:
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Setting up sinus preference generator master[%u] `%s' and slave [%u] `%s' baserate %u Bips, amplitude %u Bps\n",
- dest->me->no, GNUNET_i2s (&dest->me->id),
- dest->dest->no, GNUNET_i2s (&dest->dest->id),
- base_value, value_rate);
- break;
-
- case GNUNET_ATS_TEST_TG_RANDOM:
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Setting up random preference generator master[%u] `%s' and slave [%u] `%s' min %u Bips max %u Bps\n",
- dest->me->no, GNUNET_i2s (&dest->me->id),
- dest->dest->no, GNUNET_i2s (&dest->dest->id),
- base_value, value_rate);
- break;
-
- default:
- break;
- }
-
- dest->pg = pg;
- pg->set_task = GNUNET_SCHEDULER_add_now (&set_pref_task, dest);
- return pg;
-}
-
-
-void
-GNUNET_ATS_TEST_generate_preferences_stop (struct PreferenceGenerator *pg)
-{
- GNUNET_CONTAINER_DLL_remove (pg_head, pg_tail, pg);
- pg->dest->pg = NULL;
-
- if (NULL != pg->set_task)
- {
- GNUNET_SCHEDULER_cancel (pg->set_task);
- pg->set_task = NULL;
- }
-
- GNUNET_free (pg);
-}
-
-
-/**
- * Stop all preferences generators
- */
-void
-GNUNET_ATS_TEST_generate_preferences_stop_all ()
-{
- struct PreferenceGenerator *cur;
- struct PreferenceGenerator *next;
-
- next = pg_head;
- for (cur = next; NULL != cur; cur = next)
- {
- next = cur->next;
- GNUNET_ATS_TEST_generate_preferences_stop (cur);
- }
-}
-
-
-/* end of file ats-testing-preferences.c */
diff --git a/src/ats-tests/ats-testing-traffic.c b/src/ats-tests/ats-testing-traffic.c
deleted file mode 100644
index f19eac871..000000000
--- a/src/ats-tests/ats-testing-traffic.c
+++ /dev/null
@@ -1,393 +0,0 @@
-/*
- This file is part of GNUnet.
- Copyright (C) 2010-2013, 2016 GNUnet e.V.
-
- GNUnet is free software: you can redistribute it and/or modify it
- under the terms of the GNU Affero General Public License as published
- by the Free Software Foundation, either version 3 of the License,
- or (at your option) any later version.
-
- GNUnet is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-
- SPDX-License-Identifier: AGPL3.0-or-later
- */
-/**
- * @file ats-tests/ats-testing-traffic.c
- * @brief ats benchmark: traffic generator
- * @author Christian Grothoff
- * @author Matthias Wachs
- */
-#include "platform.h"
-#include "gnunet_util_lib.h"
-#include "ats-testing.h"
-
-static struct TrafficGenerator *tg_head;
-static struct TrafficGenerator *tg_tail;
-
-extern struct GNUNET_ATS_TEST_Topology *top;
-
-static struct GNUNET_TIME_Relative
-get_delay (struct TrafficGenerator *tg)
-{
- struct GNUNET_TIME_Relative delay;
- struct GNUNET_TIME_Relative time_delta;
- long long int cur_rate;
- long long int delta_rate;
-
- delay.rel_value_us = 0;
-
- /* Calculate the current transmission rate based on the type of traffic */
- switch (tg->type)
- {
- case GNUNET_ATS_TEST_TG_CONSTANT:
- if (UINT32_MAX == tg->base_rate)
- return GNUNET_TIME_UNIT_ZERO;
- cur_rate = tg->base_rate;
- break;
-
- case GNUNET_ATS_TEST_TG_LINEAR:
- time_delta = GNUNET_TIME_absolute_get_duration (tg->time_start);
- /* Calculate point of time in the current period */
- time_delta.rel_value_us = time_delta.rel_value_us
- % tg->duration_period.rel_value_us;
- delta_rate = ((double) time_delta.rel_value_us
- / tg->duration_period.rel_value_us)
- * (tg->max_rate - tg->base_rate);
- if ((tg->max_rate < tg->base_rate) && ((tg->max_rate - tg->base_rate) >
- tg->base_rate))
- {
- /* This will cause an underflow */
- GNUNET_break (0);
- }
- cur_rate = tg->base_rate + delta_rate;
- break;
-
- case GNUNET_ATS_TEST_TG_RANDOM:
- cur_rate = tg->base_rate + GNUNET_CRYPTO_random_u32 (
- GNUNET_CRYPTO_QUALITY_WEAK,
- tg->max_rate
- - tg->base_rate);
- break;
-
- case GNUNET_ATS_TEST_TG_SINUS:
- time_delta = GNUNET_TIME_absolute_get_duration (tg->time_start);
- /* Calculate point of time in the current period */
- time_delta.rel_value_us = time_delta.rel_value_us
- % tg->duration_period.rel_value_us;
- if ((tg->max_rate - tg->base_rate) > tg->base_rate)
- {
- /* This will cause an underflow for second half of sinus period,
- * will be detected in general when experiments are loaded */
- GNUNET_break (0);
- }
- delta_rate = (tg->max_rate - tg->base_rate)
- * sin ((2 * M_PI)
- / ((double) tg->duration_period.rel_value_us)
- * time_delta.rel_value_us);
- cur_rate = tg->base_rate + delta_rate;
- break;
-
- default:
- return delay;
- break;
- }
-
- if (cur_rate < 0)
- {
- cur_rate = 1;
- }
- /* Calculate the delay for the next message based on the current delay */
- delay.rel_value_us = GNUNET_TIME_UNIT_SECONDS.rel_value_us
- * TEST_MESSAGE_SIZE / cur_rate;
-
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Current rate is %lld, calculated delay is %llu\n",
- cur_rate,
- (unsigned long long) delay.rel_value_us);
- return delay;
-}
-
-
-static void
-update_ping_data (void *cls)
-{
- struct BenchmarkPartner *p = cls;
- struct GNUNET_TIME_Relative delay;
-
- p->messages_sent++;
- p->bytes_sent += TEST_MESSAGE_SIZE;
- p->me->total_messages_sent++;
- p->me->total_bytes_sent += TEST_MESSAGE_SIZE;
-
- if (NULL == p->tg)
- {
- GNUNET_break (0);
- return;
- }
- delay = get_delay (p->tg);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Delay for next transmission %s\n",
- GNUNET_STRINGS_relative_time_to_string (delay,
- GNUNET_YES));
- p->tg->next_ping_transmission
- = GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get (),
- delay);
-}
-
-
-static void
-comm_schedule_send (void *cls)
-{
- struct BenchmarkPartner *p = cls;
- struct TestMessage *msg;
- struct GNUNET_MQ_Envelope *env;
-
- p->tg->send_task = NULL;
- p->last_message_sent = GNUNET_TIME_absolute_get ();
- env = GNUNET_MQ_msg (msg,
- TEST_MESSAGE_TYPE_PING);
- memset (msg->padding,
- 'a',
- sizeof(msg->padding));
- GNUNET_MQ_notify_sent (env,
- &update_ping_data,
- p);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Master [%u]: Sending PING to [%u]\n",
- p->me->no,
- p->dest->no);
- GNUNET_MQ_send (p->mq,
- env);
-}
-
-
-static void
-update_pong_data (void *cls)
-{
- struct BenchmarkPartner *p = cls;
-
- p->messages_sent++;
- p->bytes_sent += TEST_MESSAGE_SIZE;
- p->me->total_messages_sent++;
- p->me->total_bytes_sent += TEST_MESSAGE_SIZE;
-}
-
-
-void
-GNUNET_ATS_TEST_traffic_handle_ping (struct BenchmarkPartner *p)
-{
- struct TestMessage *msg;
- struct GNUNET_MQ_Envelope *env;
-
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Slave [%u]: Received PING from [%u], sending PONG\n",
- p->me->no,
- p->dest->no);
- p->messages_received++;
- p->bytes_received += TEST_MESSAGE_SIZE;
- p->me->total_messages_received++;
- p->me->total_bytes_received += TEST_MESSAGE_SIZE;
-
-
- env = GNUNET_MQ_msg (msg,
- TEST_MESSAGE_TYPE_PING);
- memset (msg->padding,
- 'a',
- sizeof(msg->padding));
- GNUNET_MQ_notify_sent (env,
- &update_pong_data,
- p);
- GNUNET_MQ_send (p->mq,
- env);
-}
-
-
-void
-GNUNET_ATS_TEST_traffic_handle_pong (struct BenchmarkPartner *p)
-{
- struct GNUNET_TIME_Relative left;
-
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Master [%u]: Received PONG from [%u], next message\n",
- p->me->no,
- p->dest->no);
-
- p->messages_received++;
- p->bytes_received += TEST_MESSAGE_SIZE;
- p->me->total_messages_received++;
- p->me->total_bytes_received += TEST_MESSAGE_SIZE;
- p->total_app_rtt += GNUNET_TIME_absolute_get_difference (p->last_message_sent,
- GNUNET_TIME_absolute_get ())
- .rel_value_us;
-
- /* Schedule next send event */
- if (NULL == p->tg)
- return;
-
- left = GNUNET_TIME_absolute_get_remaining (p->tg->next_ping_transmission);
- if (UINT32_MAX == p->tg->base_rate)
- {
- p->tg->send_task = GNUNET_SCHEDULER_add_now (&comm_schedule_send, p);
- }
- else if (0 == left.rel_value_us)
- {
- p->tg->send_task = GNUNET_SCHEDULER_add_now (&comm_schedule_send, p);
- }
- else
- {
- /* Enforce minimum transmission rate 1 msg / sec */
- if (GNUNET_TIME_UNIT_SECONDS.rel_value_us == (left =
- GNUNET_TIME_relative_min (
- left,
- GNUNET_TIME_UNIT_SECONDS))
- .rel_value_us)
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Enforcing minimum send rate between master [%u] and slave [%u]\n",
- p->me->no, p->dest->no);
- p->tg->send_task = GNUNET_SCHEDULER_add_delayed (left,
- &comm_schedule_send, p);
- }
-}
-
-
-/**
- * Generate between the source master and the partner and send traffic with a
- * maximum rate.
- *
- * @param src traffic source
- * @param dest traffic partner
- * @param type type of traffic to generate
- * @param base_rate traffic base rate to send data with
- * @param max_rate traffic maximum rate to send data with
- * @param period duration of a period of traffic generation (~ 1/frequency)
- * @param duration how long to generate traffic
- * @return the traffic generator
- */
-struct TrafficGenerator *
-GNUNET_ATS_TEST_generate_traffic_start (struct BenchmarkPeer *src,
- struct BenchmarkPartner *dest,
- enum GeneratorType type,
- unsigned int base_rate,
- unsigned int max_rate,
- struct GNUNET_TIME_Relative period,
- struct GNUNET_TIME_Relative duration)
-{
- struct TrafficGenerator *tg;
-
- if (NULL != dest->tg)
- {
- GNUNET_break (0);
- return NULL;
- }
-
- tg = GNUNET_new (struct TrafficGenerator);
- GNUNET_CONTAINER_DLL_insert (tg_head,
- tg_tail,
- tg);
- tg->type = type;
- tg->src = src;
- tg->dest = dest;
- tg->base_rate = base_rate;
- tg->max_rate = max_rate;
- tg->duration_period = period;
- tg->time_start = GNUNET_TIME_absolute_get ();
- tg->next_ping_transmission = GNUNET_TIME_UNIT_FOREVER_ABS;
-
- switch (type)
- {
- case GNUNET_ATS_TEST_TG_CONSTANT:
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Setting up constant traffic generator master[%u] `%s' and slave [%u] `%s' max %u Bips\n",
- dest->me->no,
- GNUNET_i2s (&dest->me->id),
- dest->dest->no,
- GNUNET_i2s (&dest->dest->id),
- base_rate);
- break;
-
- case GNUNET_ATS_TEST_TG_LINEAR:
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Setting up linear traffic generator master[%u] `%s' and slave [%u] `%s' min %u Bips max %u Bips\n",
- dest->me->no,
- GNUNET_i2s (&dest->me->id),
- dest->dest->no,
- GNUNET_i2s (&dest->dest->id),
- base_rate,
- max_rate);
- break;
-
- case GNUNET_ATS_TEST_TG_SINUS:
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Setting up sinus traffic generator master[%u] `%s' and slave [%u] `%s' baserate %u Bips, amplitude %u Bps\n",
- dest->me->no,
- GNUNET_i2s (&dest->me->id),
- dest->dest->no,
- GNUNET_i2s (&dest->dest->id),
- base_rate,
- max_rate);
- break;
-
- case GNUNET_ATS_TEST_TG_RANDOM:
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Setting up random traffic generator master[%u] `%s' and slave [%u] `%s' min %u Bips max %u Bps\n",
- dest->me->no,
- GNUNET_i2s (&dest->me->id),
- dest->dest->no,
- GNUNET_i2s (&dest->dest->id),
- base_rate,
- max_rate);
- break;
-
- default:
- break;
- }
-
- dest->tg = tg;
- tg->send_task
- = GNUNET_SCHEDULER_add_now (&comm_schedule_send,
- dest);
- return tg;
-}
-
-
-void
-GNUNET_ATS_TEST_generate_traffic_stop (struct TrafficGenerator *tg)
-{
- GNUNET_CONTAINER_DLL_remove (tg_head,
- tg_tail,
- tg);
- tg->dest->tg = NULL;
- if (NULL != tg->send_task)
- {
- GNUNET_SCHEDULER_cancel (tg->send_task);
- tg->send_task = NULL;
- }
- GNUNET_free (tg);
-}
-
-
-/**
- * Stop all traffic generators
- */
-void
-GNUNET_ATS_TEST_generate_traffic_stop_all ()
-{
- struct TrafficGenerator *cur;
- struct TrafficGenerator *next;
-
- next = tg_head;
- for (cur = next; NULL != cur; cur = next)
- {
- next = cur->next;
- GNUNET_ATS_TEST_generate_traffic_stop (cur);
- }
-}
-
-
-/* end of file ats-testing-traffic.c */
diff --git a/src/ats-tests/ats-testing.c b/src/ats-tests/ats-testing.c
deleted file mode 100644
index c6ba8533d..000000000
--- a/src/ats-tests/ats-testing.c
+++ /dev/null
@@ -1,975 +0,0 @@
-/*
- This file is part of GNUnet.
- Copyright (C) 2010-2013, 2016, 2017 GNUnet e.V.
-
- GNUnet is free software: you can redistribute it and/or modify it
- under the terms of the GNU Affero General Public License as published
- by the Free Software Foundation, either version 3 of the License,
- or (at your option) any later version.
-
- GNUnet is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-
- SPDX-License-Identifier: AGPL3.0-or-later
- */
-/**
- * @file ats-tests/ats-testing.c
- * @brief ats testing library: setup topology
- * solvers
- * @author Christian Grothoff
- * @author Matthias Wachs
- */
-#include "ats-testing.h"
-
-
-/**
- * Connect peers with testbed
- */
-struct TestbedConnectOperation
-{
- /**
- * The benchmarking master initiating this connection
- */
- struct BenchmarkPeer *master;
-
- /**
- * The benchmarking slave to connect to
- */
- struct BenchmarkPeer *slave;
-
- /**
- * Testbed operation to connect peers
- */
- struct GNUNET_TESTBED_Operation *connect_op;
-};
-
-struct GNUNET_CONFIGURATION_Handle *cfg;
-
-struct GNUNET_ATS_TEST_Topology *top;
-
-
-/**
- * Shutdown nicely
- *
- * @param cls NULL
- */
-static void
-do_shutdown (void *cls)
-{
- int c_m;
- int c_s;
- int c_op;
- struct BenchmarkPeer *p;
-
- top->state.benchmarking = GNUNET_NO;
-
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Benchmarking done\n");
-
- GNUNET_ATS_TEST_generate_traffic_stop_all ();
-
- for (c_m = 0; c_m < top->num_masters; c_m++)
- {
- p = &top->mps[c_m];
- if (NULL != top->mps[c_m].peer_id_op)
- {
- GNUNET_TESTBED_operation_done (p->peer_id_op);
- p->peer_id_op = NULL;
- }
-
- if (NULL != p->ats_task)
- GNUNET_SCHEDULER_cancel (p->ats_task);
- p->ats_task = NULL;
-
- for (c_op = 0; c_op < p->num_partners; c_op++)
- {
- if ((NULL != p->core_connect_ops) &&
- (NULL != p->core_connect_ops[c_op].connect_op))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Failed to connect peer 0 and %u\n",
- c_op);
- GNUNET_TESTBED_operation_done (p->core_connect_ops[c_op].connect_op);
- p->core_connect_ops[c_op].connect_op = NULL;
- }
- }
-
- if (NULL != p->ats_perf_op)
- {
- GNUNET_TESTBED_operation_done (p->ats_perf_op);
- p->ats_perf_op = NULL;
- }
-
- if (NULL != p->comm_op)
- {
- GNUNET_TESTBED_operation_done (p->comm_op);
- p->comm_op = NULL;
- }
- GNUNET_free (p->core_connect_ops);
- GNUNET_free (p->partners);
- p->partners = NULL;
- }
-
- for (c_s = 0; c_s < top->num_slaves; c_s++)
- {
- p = &top->sps[c_s];
- if (NULL != p->peer_id_op)
- {
- GNUNET_TESTBED_operation_done (p->peer_id_op);
- p->peer_id_op = NULL;
- }
- if (NULL != p->ats_perf_op)
- {
- GNUNET_TESTBED_operation_done (p->ats_perf_op);
- p->ats_perf_op = NULL;
- }
- if (NULL != p->comm_op)
- {
- GNUNET_TESTBED_operation_done (p->comm_op);
- p->comm_op = NULL;
- }
- GNUNET_free (p->partners);
- p->partners = NULL;
- }
- GNUNET_SCHEDULER_shutdown ();
- GNUNET_free (top);
- top = NULL;
-}
-
-
-static struct BenchmarkPartner *
-find_partner (struct BenchmarkPeer *me,
- const struct GNUNET_PeerIdentity *peer)
-{
- int c_m;
-
- for (c_m = 0; c_m < me->num_partners; c_m++)
- {
- /* Find a partner with other as destination */
- if (0 == GNUNET_memcmp (peer,
- &me->partners[c_m].dest->id))
- {
- return &me->partners[c_m];
- }
- }
-
- return NULL;
-}
-
-
-static struct BenchmarkPeer *
-find_peer (const struct GNUNET_PeerIdentity *peer)
-{
- int c_p;
-
- for (c_p = 0; c_p < top->num_masters; c_p++)
- {
- if (0 == GNUNET_memcmp (&top->mps[c_p].id,
- peer))
- return &top->mps[c_p];
- }
-
- for (c_p = 0; c_p < top->num_slaves; c_p++)
- {
- if (0 == GNUNET_memcmp (&top->sps[c_p].id,
- peer))
- return &top->sps[c_p];
- }
- return NULL;
-}
-
-
-/**
- * Method called whenever a given peer connects.
- *
- * @param cls closure
- * @param peer peer identity this notification is about
- * @param mq queue to use to send messages to @a peer
- * @return the `struct BenchmarkPartner` of @a peer
- */
-static void *
-comm_connect_cb (void *cls,
- const struct GNUNET_PeerIdentity *peer,
- struct GNUNET_MQ_Handle *mq)
-{
- struct BenchmarkPeer *me = cls;
- struct BenchmarkPeer *remote;
- struct BenchmarkPartner *p;
- char *id;
- int c;
- int completed;
-
- remote = find_peer (peer);
- if (NULL == remote)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
- "Unknown peer connected: `%s'\n",
- GNUNET_i2s (peer));
- GNUNET_break (0);
- return NULL;
- }
-
- id = GNUNET_strdup (GNUNET_i2s (&me->id));
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%s [%u] `%s' connected to %s [%u] %s\n",
- (me->master == GNUNET_YES) ? "Master" : "Slave",
- me->no,
- id,
- (remote->master == GNUNET_YES) ? "Master" : "Slave",
- remote->no,
- GNUNET_i2s (peer));
-
- me->core_connections++;
- if ((GNUNET_YES == me->master) &&
- (GNUNET_NO == remote->master) &&
- (GNUNET_NO == top->state.connected_CORE))
- {
- me->core_slave_connections++;
-
- if (me->core_slave_connections == top->num_slaves)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Master [%u] connected all slaves\n",
- me->no);
- }
- completed = GNUNET_YES;
- for (c = 0; c < top->num_masters; c++)
- {
- if (top->mps[c].core_slave_connections != top->num_slaves)
- completed = GNUNET_NO;
- }
- if (GNUNET_YES == completed)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "All master peers connected all slave peers\n");
- top->state.connected_CORE = GNUNET_YES;
- /* Notify about setup done */
- if (NULL != top->done_cb)
- top->done_cb (top->done_cb_cls,
- top->mps,
- top->sps);
- }
- }
- GNUNET_free (id);
- p = find_partner (me,
- peer);
- if (NULL != p)
- p->mq = mq;
- return p;
-}
-
-
-/**
- * @param cls this peer
- * @param peer id of disconnecting peer
- * @param internal_cls the `struct BenchmarkPartner` of @a peer
- */
-static void
-comm_disconnect_cb (void *cls,
- const struct GNUNET_PeerIdentity *peer,
- void *internal_cls)
-{
- struct BenchmarkPeer *me = cls;
- struct BenchmarkPartner *p = internal_cls;
- char *id;
-
- if (NULL == p)
- return;
-
- id = GNUNET_strdup (GNUNET_i2s (&me->id));
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%s disconnected from %s\n",
- id,
- GNUNET_i2s (peer));
- GNUNET_assert (me->core_connections > 0);
- me->core_connections--;
-
- if ((GNUNET_YES == top->state.benchmarking) &&
- ((GNUNET_YES == me->master) ||
- (GNUNET_YES == p->dest->master)))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "%s disconnected from %s while benchmarking\n",
- id,
- GNUNET_i2s (peer));
- }
- GNUNET_free (id);
-}
-
-
-static void
-handle_pong (void *cls,
- const struct TestMessage *message)
-{
- struct BenchmarkPartner *p = cls;
-
- GNUNET_ATS_TEST_traffic_handle_pong (p);
-}
-
-
-static void
-handle_ping (void *cls,
- const struct TestMessage *message)
-{
- struct BenchmarkPartner *p = cls;
-
- GNUNET_ATS_TEST_traffic_handle_ping (p);
-}
-
-
-static void *
-transport_connect_adapter (void *cls,
- const struct GNUNET_CONFIGURATION_Handle *cfg)
-{
- struct BenchmarkPeer *me = cls;
- struct GNUNET_MQ_MessageHandler handlers[] = {
- GNUNET_MQ_hd_fixed_size (ping,
- TEST_MESSAGE_TYPE_PING,
- struct TestMessage,
- me),
- GNUNET_MQ_hd_fixed_size (pong,
- TEST_MESSAGE_TYPE_PONG,
- struct TestMessage,
- me),
- GNUNET_MQ_handler_end ()
- };
-
- me->th = GNUNET_TRANSPORT_core_connect (cfg,
- &me->id,
- handlers,
- me,
- &comm_connect_cb,
- &comm_disconnect_cb,
- NULL);
- if (NULL == me->th)
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Failed to create transport connection \n");
- return me->th;
-}
-
-
-static void
-transport_disconnect_adapter (void *cls,
- void *op_result)
-{
- struct BenchmarkPeer *me = cls;
-
- GNUNET_TRANSPORT_core_disconnect (me->th);
- me->th = NULL;
-}
-
-
-static void *
-core_connect_adapter (void *cls,
- const struct GNUNET_CONFIGURATION_Handle *cfg)
-{
- struct BenchmarkPeer *me = cls;
- struct GNUNET_MQ_MessageHandler handlers[] = {
- GNUNET_MQ_hd_fixed_size (ping,
- TEST_MESSAGE_TYPE_PING,
- struct TestMessage,
- me),
- GNUNET_MQ_hd_fixed_size (pong,
- TEST_MESSAGE_TYPE_PONG,
- struct TestMessage,
- me),
- GNUNET_MQ_handler_end ()
- };
-
- me->ch = GNUNET_CORE_connect (cfg,
- me,
- NULL,
- &comm_connect_cb,
- &comm_disconnect_cb,
- handlers);
- if (NULL == me->ch)
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Failed to create core connection \n");
- return me->ch;
-}
-
-
-static void
-core_disconnect_adapter (void *cls,
- void *op_result)
-{
- struct BenchmarkPeer *me = cls;
-
- GNUNET_CORE_disconnect (me->ch);
- me->ch = NULL;
-}
-
-
-static void
-connect_completion_callback (void *cls,
- struct GNUNET_TESTBED_Operation *op,
- const char *emsg)
-{
- struct TestbedConnectOperation *cop = cls;
- static int ops = 0;
- int c;
-
- if (NULL == emsg)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- _ ("Connected master [%u] with slave [%u]\n"),
- cop->master->no,
- cop->slave->no);
- }
- else
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _ ("Failed to connect master peer [%u] with slave [%u]\n"),
- cop->master->no, cop->slave->no);
- GNUNET_break (0);
- GNUNET_SCHEDULER_shutdown ();
- }
- GNUNET_TESTBED_operation_done (op);
- ops++;
- for (c = 0; c < top->num_slaves; c++)
- {
- if (cop == &cop->master->core_connect_ops[c])
- cop->master->core_connect_ops[c].connect_op = NULL;
- }
- if (ops == top->num_masters * top->num_slaves)
- {
- top->state.connected_PEERS = GNUNET_YES;
- }
-}
-
-
-static void
-do_connect_peers (void *cls)
-{
- int c_m;
- int c_s;
- struct BenchmarkPeer *p;
-
- if ((top->state.connected_ATS_service == GNUNET_NO) ||
- (top->state.connected_COMM_service == GNUNET_NO))
- return;
-
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Connecting peers on CORE level\n");
- for (c_m = 0; c_m < top->num_masters; c_m++)
- {
- p = &top->mps[c_m];
- p->core_connect_ops = GNUNET_malloc (top->num_slaves
- * sizeof(struct
- TestbedConnectOperation));
-
- for (c_s = 0; c_s < top->num_slaves; c_s++)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Connecting master [%u] with slave [%u]\n",
- p->no,
- top->sps[c_s].no);
- p->core_connect_ops[c_s].master = p;
- p->core_connect_ops[c_s].slave = &top->sps[c_s];
- p->core_connect_ops[c_s].connect_op
- = GNUNET_TESTBED_overlay_connect (NULL,
- &connect_completion_callback,
- &p->core_connect_ops[c_s],
- top->sps[c_s].peer,
- p->peer);
- if (NULL == p->core_connect_ops[c_s].connect_op)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Could not connect master [%u] and slave [%u]\n",
- p->no,
- top->sps[c_s].no);
- GNUNET_break (0);
- GNUNET_SCHEDULER_shutdown ();
- return;
- }
- }
- }
-}
-
-
-static void
-comm_connect_completion_cb (void *cls,
- struct GNUNET_TESTBED_Operation *op,
- void *ca_result,
- const char *emsg)
-{
- static int comm_done = 0;
-
- if ((NULL != emsg) || (NULL == ca_result))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Initialization failed, shutdown\n");
- GNUNET_break (0);
- GNUNET_SCHEDULER_shutdown ();
- return;
- }
- comm_done++;
-
- if (comm_done == top->num_slaves + top->num_masters)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Connected to all %s services\n",
- (GNUNET_YES == top->test_core) ? "CORE" : "TRANSPORT");
- top->state.connected_COMM_service = GNUNET_YES;
- GNUNET_SCHEDULER_add_now (&do_connect_peers,
- NULL);
- }
-}
-
-
-static void
-do_comm_connect (void *cls)
-{
- int c_s;
- int c_m;
-
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Connecting to all %s services\n",
- (GNUNET_YES == top->test_core) ? "CORE" : "TRANSPORT");
- for (c_m = 0; c_m < top->num_masters; c_m++)
- {
- if (GNUNET_YES == top->test_core)
- top->mps[c_m].comm_op
- = GNUNET_TESTBED_service_connect (NULL,
- top->mps[c_m].peer,
- "core",
- &comm_connect_completion_cb,
- NULL,
- &core_connect_adapter,
- &core_disconnect_adapter,
- &top->mps[c_m]);
- else
- {
- top->mps[c_m].comm_op
- = GNUNET_TESTBED_service_connect (NULL,
- top->mps[c_m].peer,
- "transport",
- &comm_connect_completion_cb,
- NULL,
- &transport_connect_adapter,
- &transport_disconnect_adapter,
- &top->mps[c_m]);
- }
- }
-
- for (c_s = 0; c_s < top->num_slaves; c_s++)
- {
- if (GNUNET_YES == top->test_core)
- top->sps[c_s].comm_op
- = GNUNET_TESTBED_service_connect (NULL,
- top->sps[c_s].peer,
- "core",
- &comm_connect_completion_cb,
- NULL,
- &core_connect_adapter,
- &core_disconnect_adapter,
- &top->sps[c_s]);
- else
- {
- top->sps[c_s].comm_op
- = GNUNET_TESTBED_service_connect (NULL,
- top->sps[c_s].peer,
- "transport",
- &comm_connect_completion_cb,
- NULL,
- &transport_connect_adapter,
- &transport_disconnect_adapter,
- &top->sps[c_s]);
- }
- }
-}
-
-
-static void
-ats_performance_info_cb (void *cls,
- const struct GNUNET_HELLO_Address *address,
- int address_active,
- struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
- struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
- const struct GNUNET_ATS_Properties *ats_prop)
-{
- struct BenchmarkPeer *me = cls;
- struct BenchmarkPartner *p;
- int log;
- char *peer_id;
-
- if (NULL == address)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Peer %u: ATS Service disconnected!\n",
- me->no);
- return;
- }
-
- p = find_partner (me,
- &address->peer);
- if (NULL == p)
- {
- /* This is not one of my partners
- * Will happen since the peers will connect to each other due to gossiping
- */
- return;
- }
- peer_id = GNUNET_strdup (GNUNET_i2s (&me->id));
-
- log = GNUNET_NO;
- if ((p->bandwidth_in != ntohl (bandwidth_in.value__)) ||
- (p->bandwidth_out != ntohl (bandwidth_out.value__)))
- log = GNUNET_YES;
- p->bandwidth_in = ntohl (bandwidth_in.value__);
- p->bandwidth_out = ntohl (bandwidth_out.value__);
-
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%s [%u] received ATS information: %s\n",
- (GNUNET_YES == p->me->master) ? "Master" : "Slave",
- p->me->no,
- GNUNET_i2s (&p->dest->id));
-
- p->props.utilization_out = ats_prop->utilization_out;
- p->props.utilization_in = ats_prop->utilization_in;
- p->props.scope = ats_prop->scope;
- p->props.delay = ats_prop->delay;
- p->props.distance = ats_prop->distance;
-
- if (GNUNET_YES == log)
- top->ats_perf_cb (cls, address,
- address_active,
- bandwidth_out,
- bandwidth_in,
- ats_prop);
- GNUNET_free (peer_id);
-}
-
-
-static void *
-ats_perf_connect_adapter (void *cls,
- const struct GNUNET_CONFIGURATION_Handle *cfg)
-{
- struct BenchmarkPeer *me = cls;
-
- me->ats_perf_handle
- = GNUNET_ATS_performance_init (cfg,
- &ats_performance_info_cb,
- me);
- if (NULL == me->ats_perf_handle)
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Failed to create ATS performance handle \n");
- return me->ats_perf_handle;
-}
-
-
-static void
-ats_perf_disconnect_adapter (void *cls,
- void *op_result)
-{
- struct BenchmarkPeer *me = cls;
-
- GNUNET_ATS_performance_done (me->ats_perf_handle);
- me->ats_perf_handle = NULL;
-}
-
-
-static void
-ats_connect_completion_cb (void *cls,
- struct GNUNET_TESTBED_Operation *op,
- void *ca_result,
- const char *emsg)
-{
- static int op_done = 0;
-
- if ((NULL != emsg) || (NULL == ca_result))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Initialization failed, shutdown\n");
- GNUNET_break (0);
- GNUNET_SCHEDULER_shutdown ();
- return;
- }
- op_done++;
- if (op_done == (top->num_masters + top->num_slaves))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Connected to all ATS services\n");
- top->state.connected_ATS_service = GNUNET_YES;
- GNUNET_SCHEDULER_add_now (&do_comm_connect,
- NULL);
- }
-}
-
-
-static void
-do_connect_ats (void *cls)
-{
- int c_m;
- int c_s;
-
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Connecting to all ATS services\n");
- for (c_m = 0; c_m < top->num_masters; c_m++)
- {
- top->mps[c_m].ats_perf_op
- = GNUNET_TESTBED_service_connect (NULL,
- top->mps[c_m].peer,
- "ats",
- &ats_connect_completion_cb,
- NULL,
- &ats_perf_connect_adapter,
- &ats_perf_disconnect_adapter,
- &top->mps[c_m]);
- }
-
- for (c_s = 0; c_s < top->num_slaves; c_s++)
- {
- top->sps[c_s].ats_perf_op
- = GNUNET_TESTBED_service_connect (NULL,
- top->sps[c_s].peer,
- "ats",
- &ats_connect_completion_cb,
- NULL,
- &ats_perf_connect_adapter,
- &ats_perf_disconnect_adapter,
- &top->sps[c_s]);
- }
-}
-
-
-static void
-peerinformation_cb (void *cb_cls,
- struct GNUNET_TESTBED_Operation *op,
- const struct GNUNET_TESTBED_PeerInformation *pinfo,
- const char *emsg)
-{
- struct BenchmarkPeer *p = cb_cls;
- static int done = 0;
-
- GNUNET_assert (pinfo->pit == GNUNET_TESTBED_PIT_IDENTITY);
-
- p->id = *pinfo->result.id;
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "%s [%u] has peer id `%s'\n",
- (p->master == GNUNET_YES) ? "Master" : "Slave",
- p->no,
- GNUNET_i2s (&p->id));
-
- GNUNET_TESTBED_operation_done (op);
- p->peer_id_op = NULL;
- done++;
-
- if (done == top->num_slaves + top->num_masters)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Retrieved all peer ID, connect to ATS\n");
- GNUNET_SCHEDULER_add_now (&do_connect_ats,
- NULL);
- }
-}
-
-
-/**
- * Signature of a main function for a testcase.
- *
- * @param cls closure
- * @param h testbed handle
- * @param num_peers number of peers in 'peers'
- * @param peers_ handle to peers run in the testbed
- * @param links_succeeded the number of overlay link connection attempts that
- * succeeded
- * @param links_failed the number of overlay link connection attempts that
- * failed
- */
-static void
-main_run (void *cls,
- struct GNUNET_TESTBED_RunHandle *h,
- unsigned int num_peers,
- struct GNUNET_TESTBED_Peer **peers_,
- unsigned int links_succeeded,
- unsigned int links_failed)
-{
- int c_m;
- int c_s;
-
- GNUNET_assert (NULL == cls);
- GNUNET_assert (top->num_masters + top->num_slaves == num_peers);
- GNUNET_assert (NULL != peers_);
-
- GNUNET_SCHEDULER_add_shutdown (&do_shutdown,
- top);
-
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Setting up %u masters and %u slaves\n",
- top->num_masters,
- top->num_slaves);
-
- /* Setup master peers */
- for (c_m = 0; c_m < top->num_masters; c_m++)
- {
- GNUNET_assert (NULL != peers_[c_m]);
- top->mps[c_m].peer = peers_[c_m];
- top->mps[c_m].no = c_m;
- top->mps[c_m].master = GNUNET_YES;
- top->mps[c_m].pref_partner = &top->sps[c_m];
- top->mps[c_m].pref_value = TEST_ATS_PREFERENCE_DEFAULT;
- top->mps[c_m].partners =
- GNUNET_malloc (top->num_slaves * sizeof(struct BenchmarkPartner));
- top->mps[c_m].num_partners = top->num_slaves;
- /* Initialize partners */
- for (c_s = 0; c_s < top->num_slaves; c_s++)
- {
- top->mps[c_m].partners[c_s].me = &top->mps[c_m];
- top->mps[c_m].partners[c_s].dest = &top->sps[c_s];
- }
- /* Get configuration */
- top->mps[c_m].peer_id_op
- = GNUNET_TESTBED_peer_get_information (top->mps[c_m].peer,
- GNUNET_TESTBED_PIT_IDENTITY,
- &peerinformation_cb,
- &top->mps[c_m]);
- }
-
- /* Setup slave peers */
- for (c_s = 0; c_s < top->num_slaves; c_s++)
- {
- GNUNET_assert (NULL != peers_[c_s + top->num_masters]);
- top->sps[c_s].peer = peers_[c_s + top->num_masters];
- top->sps[c_s].no = c_s + top->num_masters;
- top->sps[c_s].master = GNUNET_NO;
- top->sps[c_s].partners =
- GNUNET_new_array (top->num_masters,
- struct BenchmarkPartner);
- top->sps[c_s].num_partners = top->num_masters;
- /* Initialize partners */
- for (c_m = 0; c_m < top->num_masters; c_m++)
- {
- top->sps[c_s].partners[c_m].me = &top->sps[c_s];
- top->sps[c_s].partners[c_m].dest = &top->mps[c_m];
-
- /* Initialize properties */
- top->sps[c_s].partners[c_m].props.delay = GNUNET_TIME_UNIT_ZERO;
- top->sps[c_s].partners[c_m].props.distance = 0;
- top->sps[c_s].partners[c_m].props.scope = GNUNET_NT_UNSPECIFIED;
- top->sps[c_s].partners[c_m].props.utilization_in = 0;
- top->sps[c_s].partners[c_m].props.utilization_out = 0;
- }
- /* Get configuration */
- top->sps[c_s].peer_id_op
- = GNUNET_TESTBED_peer_get_information (top->sps[c_s].peer,
- GNUNET_TESTBED_PIT_IDENTITY,
- &peerinformation_cb,
- &top->sps[c_s]);
- }
-}
-
-
-/**
- * Controller event callback
- *
- * @param cls NULL
- * @param event the controller event
- */
-static void
-controller_event_cb (void *cls,
- const struct GNUNET_TESTBED_EventInformation *event)
-{
- switch (event->type)
- {
- case GNUNET_TESTBED_ET_CONNECT:
- break;
-
- case GNUNET_TESTBED_ET_OPERATION_FINISHED:
- break;
-
- default:
- GNUNET_break (0);
- GNUNET_SCHEDULER_shutdown ();
- }
-}
-
-
-struct BenchmarkPeer *
-GNUNET_ATS_TEST_get_peer (int src)
-{
- if (src > top->num_masters)
- return NULL;
- return &top->mps[src];
-}
-
-
-struct BenchmarkPartner *
-GNUNET_ATS_TEST_get_partner (int src,
- int dest)
-{
- if (src > top->num_masters)
- return NULL;
- if (dest > top->num_slaves)
- return NULL;
- return &top->mps[src].partners[dest];
-}
-
-
-/**
- * Create a topology for ats testing
- *
- * @param name test name
- * @param cfg_file configuration file to use for the peers
- * @param num_slaves number of slaves
- * @param num_masters number of masters
- * @param test_core connect to CORE service (GNUNET_YES) or transport (GNUNET_NO)
- * @param done_cb function to call when topology is setup
- * @param done_cb_cls cls for callback
- * @param log_request_cb callback to call when logging is required
- */
-void
-GNUNET_ATS_TEST_create_topology (char *name, char *cfg_file,
- unsigned int num_slaves,
- unsigned int num_masters,
- int test_core,
- GNUNET_ATS_TEST_TopologySetupDoneCallback
- done_cb,
- void *done_cb_cls,
- GNUNET_ATS_AddressInformationCallback
- log_request_cb)
-{
- top = GNUNET_new (struct GNUNET_ATS_TEST_Topology);
- top->num_masters = num_masters;
- top->num_slaves = num_slaves;
- top->done_cb = done_cb;
- top->done_cb_cls = done_cb_cls;
- top->test_core = test_core;
- top->ats_perf_cb = log_request_cb;
- top->mps = GNUNET_new_array (num_masters,
- struct BenchmarkPeer);
- top->sps = GNUNET_new_array (num_slaves,
- struct BenchmarkPeer);
-
- /* Start topology */
- uint64_t event_mask;
- event_mask = 0;
- event_mask |= (1LL << GNUNET_TESTBED_ET_CONNECT);
- event_mask |= (1LL << GNUNET_TESTBED_ET_OPERATION_FINISHED);
- (void) GNUNET_TESTBED_test_run (name,
- cfg_file,
- num_slaves + num_masters,
- event_mask,
- &controller_event_cb, NULL,
- &main_run, NULL);
-}
-
-
-/**
- * Shutdown topology
- */
-void
-GNUNET_ATS_TEST_shutdown_topology (void)
-{
- if (NULL == top)
- return;
- GNUNET_SCHEDULER_shutdown ();
-}
-
-
-/* end of file ats-testing.c */
diff --git a/src/ats-tests/ats-testing.h b/src/ats-tests/ats-testing.h
deleted file mode 100644
index 017ffef4f..000000000
--- a/src/ats-tests/ats-testing.h
+++ /dev/null
@@ -1,757 +0,0 @@
-/*
- This file is part of GNUnet.
- Copyright (C) 2010-2013 GNUnet e.V.
-
- GNUnet is free software: you can redistribute it and/or modify it
- under the terms of the GNU Affero General Public License as published
- by the Free Software Foundation, either version 3 of the License,
- or (at your option) any later version.
-
- GNUnet is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-
- SPDX-License-Identifier: AGPL3.0-or-later
- */
-/**
- * @file ats-tests/ats-testing.h
- * @brief ats testing library: setup topology and provide logging to test ats
- * @author Christian Grothoff
- * @author Matthias Wachs
- */
-#include "platform.h"
-#include "gnunet_util_lib.h"
-#include "gnunet_testbed_service.h"
-#include "gnunet_ats_service.h"
-#include "gnunet_core_service.h"
-#include "gnunet_transport_service.h"
-
-#define TEST_ATS_PREFERENCE_DEFAULT 1.0
-
-/**
- * Message type sent for traffic generation
- */
-#define TEST_MESSAGE_TYPE_PING 12345
-
-/**
- * Message type sent as response during traffic generation
- */
-#define TEST_MESSAGE_TYPE_PONG 12346
-
-/**
- * Size of test messages
- */
-#define TEST_MESSAGE_SIZE 100
-
-
-struct TestMessage
-{
- struct GNUNET_MessageHeader header;
-
- uint8_t padding[TEST_MESSAGE_SIZE - sizeof(struct GNUNET_MessageHeader)];
-};
-
-
-struct BenchmarkPartner;
-
-struct BenchmarkPeer;
-
-struct GNUNET_ATS_TEST_Topology;
-
-struct TrafficGenerator;
-
-struct LoggingHandle;
-
-enum GeneratorType
-{
- GNUNET_ATS_TEST_TG_LINEAR,
- GNUNET_ATS_TEST_TG_CONSTANT,
- GNUNET_ATS_TEST_TG_RANDOM,
- GNUNET_ATS_TEST_TG_SINUS
-};
-
-
-/**
- * Callback to call when topology setup is completed
- *
- * @param cls the closure
- * @param masters array of master peers
- * @param slaves array of master peers
- */
-typedef void (*GNUNET_ATS_TEST_TopologySetupDoneCallback) (
- void *cls,
- struct BenchmarkPeer *masters,
- struct BenchmarkPeer *slaves);
-
-/**
- * Callback called when logging is required for the data contained
- *
- * @param cls the closure
- * @param address an address
- * @param address_active is address active
- * @param bandwidth_out bandwidth outbound
- * @param bandwidth_in bandwidth inbound
- * @param prop performance information
- */
-typedef void (*GNUNET_ATS_TEST_LogRequest) (
- void *cls,
- const struct GNUNET_HELLO_Address *address,
- int address_active,
- struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
- struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
- const struct GNUNET_ATS_Properties *prop);
-
-/**
- * Information we track for a peer in the testbed.
- */
-struct BenchmarkPeer
-{
- /**
- * Handle with testbed.
- */
- struct GNUNET_TESTBED_Peer *peer;
-
- /**
- * Unique identifier
- */
- int no;
-
- /**
- * Is this peer a measter: GNUNET_YES/GNUNET_NO
- */
- int master;
-
- /**
- * Peer ID
- */
- struct GNUNET_PeerIdentity id;
-
- /**
- * Testbed operation to get peer information
- */
- struct GNUNET_TESTBED_Operation *peer_id_op;
-
- /**
- * Testbed operation to connect to ATS performance service
- */
- struct GNUNET_TESTBED_Operation *ats_perf_op;
-
- /**
- * Testbed operation to connect to core
- */
- struct GNUNET_TESTBED_Operation *comm_op;
-
- /**
- * ATS performance handle
- */
- struct GNUNET_ATS_PerformanceHandle *ats_perf_handle;
-
- /**
- * Masters only:
- * Testbed connect operations to connect masters to slaves
- */
- struct TestbedConnectOperation *core_connect_ops;
-
- /**
- * Core handle
- */
- struct GNUNET_CORE_Handle *ch;
-
- /**
- * Transport handle
- */
- struct GNUNET_TRANSPORT_CoreHandle *th;
-
- /**
- * Masters only:
- * Peer to set ATS preferences for
- */
- struct BenchmarkPeer *pref_partner;
-
- /**
- * Masters only
- * Progress task
- */
- struct GNUNET_SCHEDULER_Task *ats_task;
-
- /**
- * Masters only
- * Progress task
- */
- double pref_value;
-
- /**
- * Array of partners with num_slaves entries (if master) or
- * num_master entries (if slave)
- */
- struct BenchmarkPartner *partners;
-
- /**
- * Number of partners
- */
- int num_partners;
-
- /**
- * Number of core connections
- */
- int core_connections;
-
- /**
- * Masters only:
- * Number of connections to slave peers
- */
- int core_slave_connections;
-
- /**
- * Total number of messages this peer has sent
- */
- unsigned int total_messages_sent;
-
- /**
- * Total number of bytes this peer has sent
- */
- unsigned int total_bytes_sent;
-
- /**
- * Total number of messages this peer has received
- */
- unsigned int total_messages_received;
-
- /**
- * Total number of bytes this peer has received
- */
- unsigned int total_bytes_received;
-};
-
-struct TrafficGenerator
-{
- struct TrafficGenerator *prev;
- struct TrafficGenerator *next;
-
- enum GeneratorType type;
-
- struct BenchmarkPeer *src;
- struct BenchmarkPartner *dest;
-
- long int base_rate;
- long int max_rate;
- struct GNUNET_TIME_Relative duration_period;
-
- struct GNUNET_SCHEDULER_Task *send_task;
- struct GNUNET_TIME_Absolute next_ping_transmission;
- struct GNUNET_TIME_Absolute time_start;
-};
-
-
-struct PreferenceGenerator
-{
- struct PreferenceGenerator *prev;
- struct PreferenceGenerator *next;
-
- enum GeneratorType type;
-
- struct BenchmarkPeer *src;
- struct BenchmarkPartner *dest;
-
- enum GNUNET_ATS_PreferenceKind kind;
-
- long int base_value;
- long int max_value;
- struct GNUNET_TIME_Relative duration_period;
- struct GNUNET_TIME_Relative frequency;
-
- struct GNUNET_SCHEDULER_Task *set_task;
- struct GNUNET_TIME_Absolute next_ping_transmission;
- struct GNUNET_TIME_Absolute time_start;
-};
-
-/**
- * Information about a benchmarking partner
- */
-struct BenchmarkPartner
-{
- /**
- * The peer itself this partner belongs to
- */
- struct BenchmarkPeer *me;
-
- /**
- * The partner peer
- */
- struct BenchmarkPeer *dest;
-
- /**
- * Message queue handle.
- */
- struct GNUNET_MQ_Handle *mq;
-
- /**
- * Handle for traffic generator
- */
- struct TrafficGenerator *tg;
-
- /**
- * Handle for preference generator
- */
- struct PreferenceGenerator *pg;
-
- /**
- * Timestamp to calculate communication layer delay
- */
- struct GNUNET_TIME_Absolute last_message_sent;
-
- /**
- * Accumulated RTT for all messages
- */
- unsigned int total_app_rtt;
-
- /**
- * Number of messages sent to this partner
- */
- unsigned int messages_sent;
-
- /**
- * Number of bytes sent to this partner
- */
- unsigned int bytes_sent;
-
- /**
- * Number of messages received from this partner
- */
- unsigned int messages_received;
-
- /**
- * Number of bytes received from this partner
- */
- unsigned int bytes_received;
-
- /**
- * Current ATS properties
- */
- struct GNUNET_ATS_Properties props;
-
- /**
- * Bandwidth assigned inbound
- */
- uint32_t bandwidth_in;
-
- /**
- * Bandwidth assigned outbound
- */
- uint32_t bandwidth_out;
-
- /**
- * Current preference values for bandwidth
- */
- double pref_bandwidth;
-
- /**
- * Current preference values for delay
- */
- double pref_delay;
-};
-
-
-/**
- * Overall state of the performance benchmark
- */
-struct BenchmarkState
-{
- /**
- * Are we connected to ATS service of all peers: GNUNET_YES/NO
- */
- int connected_ATS_service;
-
- /**
- * Are we connected to CORE service of all peers: GNUNET_YES/NO
- */
- int connected_COMM_service;
-
- /**
- * Are we connected to all peers: GNUNET_YES/NO
- */
- int connected_PEERS;
-
- /**
- * Are we connected to all slave peers on CORE level: GNUNET_YES/NO
- */
- int connected_CORE;
-
- /**
- * Are we connected to CORE service of all peers: GNUNET_YES/NO
- */
- int benchmarking;
-};
-
-
-struct GNUNET_ATS_TEST_Topology
-{
- /**
- * Progress task
- */
- struct GNUNET_SCHEDULER_Task *progress_task;
-
- /**
- * Test result
- */
- int result;
-
- /**
- * Test core (#GNUNET_YES) or transport (#GNUNET_NO)
- */
- int test_core;
-
- /**
- * Solver string
- */
- char *solver;
-
- /**
- * Preference string
- */
- char *testname;
-
- /**
- * Preference string
- */
- char *pref_str;
-
- /**
- * ATS preference value
- */
- int pref_val;
-
- /**
- * Number master peers
- */
- unsigned int num_masters;
-
- /**
- * Array of master peers
- */
- struct BenchmarkPeer *mps;
-
- /**
- * Number slave peers
- */
- unsigned int num_slaves;
-
- /**
- * Array of slave peers
- */
- struct BenchmarkPeer *sps;
-
- /**
- * Benchmark duration
- */
- struct GNUNET_TIME_Relative perf_duration;
-
- /**
- * Logging frequency
- */
- struct GNUNET_TIME_Relative log_frequency;
-
- /**
- * Benchmark state
- */
- struct BenchmarkState state;
-
- GNUNET_ATS_TEST_TopologySetupDoneCallback done_cb;
-
- GNUNET_ATS_AddressInformationCallback ats_perf_cb;
-
- void *done_cb_cls;
-};
-
-enum OperationType
-{
- START_SEND,
- STOP_SEND,
- START_PREFERENCE,
- STOP_PREFERENCE
-};
-
-struct Episode;
-
-struct Experiment;
-
-typedef void (*GNUNET_ATS_TESTING_EpisodeDoneCallback) (struct Episode *e);
-
-typedef void (*GNUNET_ATS_TESTING_ExperimentDoneCallback) (
- struct Experiment *e,
- struct GNUNET_TIME_Relative duration,
- int success);
-
-/**
- * An operation in an experiment
- */
-struct GNUNET_ATS_TEST_Operation
-{
- struct GNUNET_ATS_TEST_Operation *next;
- struct GNUNET_ATS_TEST_Operation *prev;
-
- long long unsigned int src_id;
- long long unsigned int dest_id;
-
- long long unsigned int base_rate;
- long long unsigned int max_rate;
- struct GNUNET_TIME_Relative period;
- struct GNUNET_TIME_Relative frequency;
-
- enum OperationType type;
- enum GeneratorType gen_type;
- enum GNUNET_ATS_PreferenceKind pref_type;
-};
-
-struct Episode
-{
- int id;
- struct Episode *next;
- struct GNUNET_TIME_Relative duration;
-
- struct GNUNET_ATS_TEST_Operation *head;
- struct GNUNET_ATS_TEST_Operation *tail;
-};
-
-
-struct Experiment
-{
- char *name;
- char *cfg_file;
- unsigned long long int num_masters;
- unsigned long long int num_slaves;
- struct GNUNET_TIME_Relative log_freq;
- struct GNUNET_TIME_Relative max_duration;
- struct GNUNET_TIME_Relative total_duration;
- struct GNUNET_TIME_Absolute start_time;
- unsigned int num_episodes;
- struct Episode *start;
-
- struct GNUNET_SCHEDULER_Task *experiment_timeout_task;
- struct GNUNET_SCHEDULER_Task *episode_timeout_task;
- struct Episode *cur;
-
- GNUNET_ATS_TESTING_EpisodeDoneCallback ep_done_cb;
- GNUNET_ATS_TESTING_ExperimentDoneCallback e_done_cb;
-};
-
-
-extern struct GNUNET_CONFIGURATION_Handle *cfg;
-
-/**
- * Execute the specified experiment
- *
- * @param e the Experiment
- * @param ep_done_cb a episode is completed
- * @param e_done_cb the experiment is completed
- */
-void
-GNUNET_ATS_TEST_experimentation_run (
- struct Experiment *e,
- GNUNET_ATS_TESTING_EpisodeDoneCallback ep_done_cb,
- GNUNET_ATS_TESTING_ExperimentDoneCallback e_done_cb);
-
-
-/**
- * Load an experiment from a file
- *
- * @param filename the file
- * @return the Experiment or NULL on failure
- */
-struct Experiment *
-GNUNET_ATS_TEST_experimentation_load (const char *filename);
-
-
-/**
- * Stop an experiment
- *
- * @param e the experiment
- */
-void
-GNUNET_ATS_TEST_experimentation_stop (struct Experiment *e);
-
-
-void
-GNUNET_ATS_TEST_traffic_handle_ping (struct BenchmarkPartner *p);
-
-
-void
-GNUNET_ATS_TEST_traffic_handle_pong (struct BenchmarkPartner *p);
-
-
-/**
- * Generate between the source master and the partner and send traffic with a
- * maximum rate.
- *
- * @param src traffic source
- * @param dest traffic partner
- * @param type type of traffic to generate
- * @param base_rate traffic base rate to send data with
- * @param max_rate traffic maximum rate to send data with
- * @param period duration of a period of traffic generation (~ 1/frequency)
- * @param duration how long to generate traffic
- * @return the traffic generator
- */
-struct TrafficGenerator *
-GNUNET_ATS_TEST_generate_traffic_start (struct BenchmarkPeer *src,
- struct BenchmarkPartner *dest,
- enum GeneratorType type,
- unsigned int base_rate,
- unsigned int max_rate,
- struct GNUNET_TIME_Relative period,
- struct GNUNET_TIME_Relative duration);
-
-
-void
-GNUNET_ATS_TEST_generate_traffic_stop (struct TrafficGenerator *tg);
-
-
-/**
- * Stop all traffic generators
- */
-void
-GNUNET_ATS_TEST_generate_traffic_stop_all (void);
-
-
-/**
- * Generate between the source master and the partner and set preferences with a
- * value depending on the generator.
- *
- * @param src source
- * @param dest partner
- * @param type type of preferences to generate
- * @param base_value traffic base rate to send data with
- * @param value_rate traffic maximum rate to send data with
- * @param period duration of a period of preferences generation (~ 1/frequency)
- * @param frequency how long to generate preferences
- * @param kind ATS preference to generate
- * @return the traffic generator
- */
-struct PreferenceGenerator *
-GNUNET_ATS_TEST_generate_preferences_start (
- struct BenchmarkPeer *src,
- struct BenchmarkPartner *dest,
- enum GeneratorType type,
- unsigned int base_value,
- unsigned int value_rate,
- struct GNUNET_TIME_Relative period,
- struct GNUNET_TIME_Relative frequency,
- enum GNUNET_ATS_PreferenceKind kind);
-
-
-void
-GNUNET_ATS_TEST_generate_preferences_stop (struct PreferenceGenerator *pg);
-
-
-void
-GNUNET_ATS_TEST_generate_preferences_stop_all (void);
-
-
-/**
- * Start logging
- *
- * @param log_frequency the logging frequency
- * @param testname the testname
- * @param masters the master peers used for benchmarking
- * @param num_masters the number of master peers
- * @param num_slaves the number of slave peers
- * @param verbose verbose logging
- * @return the logging handle or NULL on error
- */
-struct LoggingHandle *
-GNUNET_ATS_TEST_logging_start (struct GNUNET_TIME_Relative log_frequency,
- const char *testname,
- struct BenchmarkPeer *masters,
- int num_masters,
- int num_slaves,
- int verbose);
-
-
-/**
- * Stop logging
- *
- * @param l the logging handle
- */
-void
-GNUNET_ATS_TEST_logging_clean_up (struct LoggingHandle *l);
-
-
-/**
- * Stop logging
- *
- * @param l the logging handle
- */
-void
-GNUNET_ATS_TEST_logging_stop (struct LoggingHandle *l);
-
-
-/**
- * Log all data now
- *
- * @param l logging handle to use
- */
-void
-GNUNET_ATS_TEST_logging_now (struct LoggingHandle *l);
-
-
-/**
- * Write logging data to file
- *
- * @param l logging handle to use
- * @param test_name name of the current test
- * @param plots create gnuplots: #GNUNET_YES or #GNUNET_NO
- */
-void
-GNUNET_ATS_TEST_logging_write_to_file (struct LoggingHandle *l,
- const char *test_name,
- int plots);
-
-
-/**
- * Topology related functions
- */
-struct BenchmarkPeer *
-GNUNET_ATS_TEST_get_peer (int src);
-
-
-struct BenchmarkPartner *
-GNUNET_ATS_TEST_get_partner (int src, int dest);
-
-
-/**
- * Create a topology for ats testing
- *
- * @param name test name
- * @param cfg_file configuration file to use for the peers
- * @param num_slaves number of slaves
- * @param num_masters number of masters
- * @param test_core connect to CORE service (#GNUNET_YES) or transport
- * (#GNUNET_NO)
- * @param done_cb function to call when topology is setup
- * @param done_cb_cls cls for callback
- * @param log_request_cb callback to call when logging is required
- */
-void
-GNUNET_ATS_TEST_create_topology (
- char *name,
- char *cfg_file,
- unsigned int num_slaves,
- unsigned int num_masters,
- int test_core,
- GNUNET_ATS_TEST_TopologySetupDoneCallback done_cb,
- void *done_cb_cls,
- GNUNET_ATS_TEST_LogRequest ats_perf_cb);
-
-
-/**
- * Shutdown topology
- */
-void
-GNUNET_ATS_TEST_shutdown_topology (void);
-
-
-/* end of file ats-testing.h */
diff --git a/src/ats-tests/experiments/evaluation1_dru_3_peers_1addr_1scope_prop.conf b/src/ats-tests/experiments/evaluation1_dru_3_peers_1addr_1scope_prop.conf
deleted file mode 100644
index 4b66e5aea..000000000
--- a/src/ats-tests/experiments/evaluation1_dru_3_peers_1addr_1scope_prop.conf
+++ /dev/null
@@ -1,24 +0,0 @@
-@INLINE@ template_perf_ats.conf
-
-[transport]
-plugins = unix
-
-[ats]
-MODE = MLP
-UNSPECIFIED_QUOTA_IN = 128 KiB
-UNSPECIFIED_QUOTA_OUT = 128 KiB
-# LOOPBACK
-LOOPBACK_QUOTA_IN = 128 KiB
-LOOPBACK_QUOTA_OUT = 128 KiB
-# LAN
-LAN_QUOTA_IN = 128 KiB
-LAN_QUOTA_OUT = 128 KiB
-# WAN
-WAN_QUOTA_IN = 128 KiB
-WAN_QUOTA_OUT = 128 KiB
-# WLAN
-WLAN_QUOTA_IN = 128 KiB
-WLAN_QUOTA_OUT = 128 KiB
-# BLUETOOTH
-BLUETOOTH_QUOTA_IN = 128 KiB
-BLUETOOTH_QUOTA_OUT = 128 KiB \ No newline at end of file
diff --git a/src/ats-tests/experiments/evaluation1_dru_3_peers_1addr_1scope_prop.exp b/src/ats-tests/experiments/evaluation1_dru_3_peers_1addr_1scope_prop.exp
deleted file mode 100644
index 6a04e7491..000000000
--- a/src/ats-tests/experiments/evaluation1_dru_3_peers_1addr_1scope_prop.exp
+++ /dev/null
@@ -1,46 +0,0 @@
-[experiment]
-name = sc1_eval_dru_prop
-masters = 1
-slaves = 3
-max_duration = 20 s
-log_freq = 100 ms
-cfg_file = experiments/evaluation1_dru_3_peers_1addr_1scope_prop.conf
-
-[episode-0]
-# operations = start_send, stop_send, start_preference, stop_preference
-duration = 10 s
-op-0-operation = start_send
-op-0-src = 0
-op-0-dest = 0
-op-0-type = constant
-#op-0-period = 10 s
-op-0-base-rate= 10000
-#op-0-max-rate = 10000
-
-op-1-operation = start_send
-op-1-src = 0
-op-1-dest = 1
-op-1-type = constant
-#op-1-period = 10 s
-op-1-base-rate= 10000
-#op-1-max-rate = 10000
-
-op-2-operation = start_send
-op-2-src = 0
-op-2-dest = 2
-op-2-type = constant
-#op-1-period = 10 s
-op-2-base-rate= 10000
-#op-1-max-rate = 10000
-
-[episode-1]
-duration = 10 s
-op-0-operation = start_preference
-op-0-src = 0
-op-0-dest = 2
-op-0-type = constant
-#op-0-period = 10 s
-op-0-pref = bandwidth
-op-0-frequency = 1 s
-op-0-base-rate= 50
-#op-0-max-rate = 10000 \ No newline at end of file
diff --git a/src/ats-tests/experiments/send_linear_10_sec.exp b/src/ats-tests/experiments/send_linear_10_sec.exp
deleted file mode 100644
index efd2c7b08..000000000
--- a/src/ats-tests/experiments/send_linear_10_sec.exp
+++ /dev/null
@@ -1,30 +0,0 @@
-[experiment]
- name = test
- masters = 1
- slaves = 3
- max_duration = 2 s
- cfg_file = gnunet_ats_sim_default.conf
-
-[episode-0]
-# operations = set_rate, start_send, stop_send, set_preference
-duration = 2 s
-op-0-operation = set_rate
-op-0-src = 0
-op-0-dest = 0
-op-0-type = constant
-op-0-base-rate= 10000
-op-0-max-rate = 10000
-
-op-1-operation = set_rate
-op-1-src = 0
-op-1-dest = 1
-op-1-type = constant
-op-1-base-rate= 10000
-op-1-max-rate = 10000
-
-op-2-operation = set_rate
-op-2-src = 0
-op-2-dest = 2
-op-2-type = constant
-op-2-base-rate= 10000
-op-2-max-rate = 10000 \ No newline at end of file
diff --git a/src/ats-tests/experiments/test.exp b/src/ats-tests/experiments/test.exp
deleted file mode 100644
index 636139f89..000000000
--- a/src/ats-tests/experiments/test.exp
+++ /dev/null
@@ -1,55 +0,0 @@
-[experiment]
- name = test
- masters = 1
- slaves = 2
- max_duration = 15 s
- log_freq = 100 ms
- cfg_file = gnunet_ats_sim_default.conf
-
-[episode-0]
-# operations = start_send, stop_send, start_preference, stop_preference
-duration = 10 s
-op-0-operation = start_send
-op-0-src = 0
-op-0-dest = 0
-op-0-type = constant
-op-0-base-rate= 10000
-op-0-max-rate = 10000
-
-op-1-operation = start_send
-op-1-src = 0
-op-1-dest = 1
-op-1-type = sinus
-op-1-period = 5 s
-op-1-base-rate= 10000
-op-1-max-rate = 15000
-
-op-2-operation = start_preference
-op-2-src = 0
-op-2-dest = 0
-op-2-type = constant
-op-2-period = 5 s
-op-2-base-rate= 10
-op-2-max-rate = 5
-op-2-pref = latency
-op-2-frequency = 2 s
-
-op-3-operation = start_preference
-op-3-src = 0
-op-3-dest = 1
-op-3-type = linear
-op-3-period = 5 s
-op-3-base-rate= 40
-op-3-max-rate = 50
-op-3-pref = bandwidth
-op-3-frequency = 750 ms
-
-[episode-1]
-duration = 5 s
-op-0-operation = stop_preference
-op-0-src = 0
-op-0-dest = 0
-
-op-1-operation = stop_preference
-op-1-src = 0
-op-1-dest = 1
diff --git a/src/ats-tests/gnunet-ats-sim.c b/src/ats-tests/gnunet-ats-sim.c
deleted file mode 100644
index 15cd52e2f..000000000
--- a/src/ats-tests/gnunet-ats-sim.c
+++ /dev/null
@@ -1,399 +0,0 @@
-/*
- This file is part of GNUnet.
- Copyright (C) 2010-2013 GNUnet e.V.
-
- GNUnet is free software: you can redistribute it and/or modify it
- under the terms of the GNU Affero General Public License as published
- by the Free Software Foundation, either version 3 of the License,
- or (at your option) any later version.
-
- GNUnet is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-
- SPDX-License-Identifier: AGPL3.0-or-later
- */
-/**
- * @file ats-tests/gnunet-ats-sim.c
- * @brief ats traffic simulator: this tool uses the ats-test library to setup a
- * topology and generate traffic between these peers. The traffic description
- * is loaded from a experiment description file
- * @author Christian Grothoff
- * @author Matthias Wachs
- */
-#include "platform.h"
-#include "gnunet_util_lib.h"
-#include "gnunet_testbed_service.h"
-#include "gnunet_ats_service.h"
-#include "gnunet_core_service.h"
-#include "ats-testing.h"
-
-#define TEST_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, \
- 10)
-
-static struct BenchmarkPeer *masters_p;
-static struct BenchmarkPeer *slaves_p;
-
-/**
- * cmd option -e: experiment file
- */
-static char *opt_exp_file;
-
-/**
- * cmd option -l: enable logging
- */
-static int opt_log;
-
-/**
- * cmd option -p: enable plots
- */
-static int opt_plot;
-
-/**
- * cmd option -v: verbose logs
- */
-static int opt_verbose;
-
-static struct GNUNET_SCHEDULER_Task *timeout_task;
-
-static struct Experiment *e;
-
-static struct LoggingHandle *l;
-
-
-static void
-evaluate (struct GNUNET_TIME_Relative duration_total)
-{
- int c_m;
- int c_s;
- unsigned int duration;
- struct BenchmarkPeer *mp;
- struct BenchmarkPartner *p;
-
- unsigned int b_sent_sec;
- double kb_sent_percent;
- unsigned int b_recv_sec;
- double kb_recv_percent;
- unsigned int rtt;
-
-
- duration = (duration_total.rel_value_us / (1000 * 1000));
- if (0 == duration)
- duration = 1;
- for (c_m = 0; c_m < e->num_masters; c_m++)
- {
- mp = &masters_p[c_m];
- fprintf (stderr,
- _ (
- "Master [%u]: sent: %u KiB in %u sec. = %u KiB/s, received: %u KiB in %u sec. = %u KiB/s\n"),
- mp->no, mp->total_bytes_sent / 1024,
- duration,
- (mp->total_bytes_sent / 1024) / duration,
- mp->total_bytes_received / 1024,
- duration,
- (mp->total_bytes_received / 1024) / duration);
-
- for (c_s = 0; c_s < e->num_slaves; c_s++)
- {
- p = &mp->partners[c_s];
-
- b_sent_sec = 0;
- b_recv_sec = 0;
- kb_sent_percent = 0.0;
- kb_recv_percent = 0.0;
- rtt = 0;
-
- if (duration > 0)
- {
- b_sent_sec = p->bytes_sent / duration;
- b_recv_sec = p->bytes_received / duration;
- }
-
- if (mp->total_bytes_sent > 0)
- kb_sent_percent = ((double) p->bytes_sent * 100) / mp->total_bytes_sent;
- if (mp->total_bytes_received > 0)
- kb_recv_percent = ((double) p->bytes_received * 100)
- / mp->total_bytes_received;
- if (1000 * p->messages_sent > 0)
- rtt = p->total_app_rtt / (1000 * p->messages_sent);
- fprintf (stderr,
- "%c Master [%u] -> Slave [%u]: sent %u Bips (%.2f %%), received %u Bips (%.2f %%)\n",
- (mp->pref_partner == p->dest) ? '*' : ' ',
- mp->no, p->dest->no,
- b_sent_sec, kb_sent_percent,
- b_recv_sec, kb_recv_percent);
- fprintf (stderr,
- "%c Master [%u] -> Slave [%u]: Average application layer RTT: %u ms\n",
- (mp->pref_partner == p->dest) ? '*' : ' ',
- mp->no, p->dest->no, rtt);
- }
- }
-}
-
-
-static void
-do_shutdown (void *cls)
-{
- fprintf (stderr, "Shutdown\n");
- if (NULL != timeout_task)
- {
- GNUNET_SCHEDULER_cancel (timeout_task);
- timeout_task = NULL;
- }
- if (NULL != l)
- {
- GNUNET_ATS_TEST_logging_stop (l);
- GNUNET_ATS_TEST_logging_clean_up (l);
- l = NULL;
- }
-
- /* Stop traffic generation */
- GNUNET_ATS_TEST_generate_traffic_stop_all ();
-
- /* Stop all preference generations */
- GNUNET_ATS_TEST_generate_preferences_stop_all ();
-
- if (NULL != e)
- {
- GNUNET_ATS_TEST_experimentation_stop (e);
- e = NULL;
- }
- GNUNET_ATS_TEST_shutdown_topology ();
-}
-
-
-static void
-do_timeout (void *cls)
-{
- timeout_task = NULL;
- GNUNET_SCHEDULER_shutdown ();
-}
-
-
-static void
-log_request__cb (void *cls,
- const struct GNUNET_HELLO_Address *address,
- int address_active,
- struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
- struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
- const struct GNUNET_ATS_Properties *ats)
-{
- if (NULL != l)
- {
- // GNUNET_break (0);
- // GNUNET_ATS_TEST_logging_now (l);
- }
-}
-
-
-static void
-experiment_done_cb (struct Experiment *e,
- struct GNUNET_TIME_Relative duration,
- int success)
-{
- if (GNUNET_OK == success)
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Experiment done successful in %s\n",
- GNUNET_STRINGS_relative_time_to_string (duration,
- GNUNET_YES));
- else
- GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Experiment failed \n");
-
- /* Stop logging */
- GNUNET_ATS_TEST_logging_stop (l);
-
- /* Stop traffic generation */
- GNUNET_ATS_TEST_generate_traffic_stop_all ();
-
- /* Stop all preference generations */
- GNUNET_ATS_TEST_generate_preferences_stop_all ();
-
- evaluate (duration);
- if (opt_log)
- GNUNET_ATS_TEST_logging_write_to_file (l, opt_exp_file, opt_plot);
- GNUNET_SCHEDULER_shutdown ();
-}
-
-
-static void
-episode_done_cb (struct Episode *ep)
-{
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Episode %u done\n",
- ep->id);
-}
-
-
-static void
-topology_setup_done (void *cls,
- struct BenchmarkPeer *masters,
- struct BenchmarkPeer *slaves)
-{
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Topology setup complete!\n");
-
- masters_p = masters;
- slaves_p = slaves;
-
- l = GNUNET_ATS_TEST_logging_start (e->log_freq,
- e->name,
- masters_p,
- e->num_masters, e->num_slaves,
- opt_verbose);
- GNUNET_ATS_TEST_experimentation_run (e,
- &episode_done_cb,
- &experiment_done_cb);
-/*
- GNUNET_ATS_TEST_generate_preferences_start(&masters[0],&masters[0].partners[0],
- GNUNET_ATS_TEST_TG_CONSTANT, 1, 1, GNUNET_TIME_UNIT_SECONDS,
- GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MILLISECONDS, 250),
- GNUNET_ATS_PREFERENCE_BANDWIDTH);
- *//*
- GNUNET_ATS_TEST_generate_preferences_start(&masters[0],&masters[0].partners[0],
- GNUNET_ATS_TEST_TG_LINEAR, 1, 50,
- GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 2),
- GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MILLISECONDS, 250),
- GNUNET_ATS_PREFERENCE_BANDWIDTH);
- *//*
- GNUNET_ATS_TEST_generate_preferences_start(&masters[0],&masters[0].partners[0],
- GNUNET_ATS_TEST_TG_RANDOM, 1, 50,
- GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 2),
- GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MILLISECONDS, 250),
- GNUNET_ATS_PREFERENCE_BANDWIDTH);
- *//*
- GNUNET_ATS_TEST_generate_preferences_start(&masters[0],&masters[0].partners[0],
- GNUNET_ATS_TEST_TG_SINUS, 10, 5,
- GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 5),
- GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MILLISECONDS, 250),
- GNUNET_ATS_PREFERENCE_BANDWIDTH);
- */
-#if 0
- int c_m;
- int c_s;
- for (c_m = 0; c_m < e->num_masters; c_m++)
- {
- for (c_s = 0; c_s < e->num_slaves; c_s++)
- {
- /* Generate maximum traffic to all peers */
- /* Example: Generate traffic with constant 10,000 Bytes/s */
- GNUNET_ATS_TEST_generate_traffic_start (&masters[c_m],
- &masters[c_m].partners[c_s],
- GNUNET_ATS_TEST_TG_CONSTANT,
- 10000,
- GNUNET_TIME_UNIT_FOREVER_REL);
- /* Example: Generate traffic with an increasing rate from 1000 to 2000
- * Bytes/s with in a minute */
- GNUNET_ATS_TEST_generate_traffic_start (&masters[c_m],
- &masters[c_m].partners[c_s],
- GNUNET_ATS_TEST_TG_LINEAR,
- 1000,
- 2000,
- GNUNET_TIME_UNIT_MINUTES,
- GNUNET_TIME_UNIT_FOREVER_REL);
- /* Example: Generate traffic with a random rate between 1000 to 2000
- * Bytes/s */
- GNUNET_ATS_TEST_generate_traffic_start (&masters[c_m],
- &masters[c_m].partners[c_s],
- GNUNET_ATS_TEST_TG_RANDOM,
- 1000,
- 2000,
- GNUNET_TIME_UNIT_FOREVER_REL,
- GNUNET_TIME_UNIT_FOREVER_REL);
- /* Example: Generate traffic with a sinus form, a base rate of
- * 1000 Bytes/s, an amplitude of (max-base), and a period of 1 minute */
- GNUNET_ATS_TEST_generate_traffic_start (&masters[c_m],
- &masters[c_m].partners[c_s],
- GNUNET_ATS_TEST_TG_SINUS,
- 1000,
- 2000,
- GNUNET_TIME_UNIT_MINUTES,
- GNUNET_TIME_UNIT_FOREVER_REL);
- }
- }
-#endif
-
- timeout_task
- = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_add (
- GNUNET_TIME_UNIT_MINUTES,
- e->max_duration),
- &do_timeout,
- NULL);
- GNUNET_SCHEDULER_add_shutdown (&do_shutdown, NULL);
-}
-
-
-static void
-parse_args (int argc, char *argv[])
-{
- int c;
-
- opt_exp_file = NULL;
- opt_log = GNUNET_NO;
- opt_plot = GNUNET_NO;
-
- for (c = 0; c < argc; c++)
- {
- if ((c < (argc - 1)) && (0 == strcmp (argv[c], "-e")))
- {
- GNUNET_free (opt_exp_file);
- opt_exp_file = GNUNET_strdup (argv[c + 1]);
- }
- if (0 == strcmp (argv[c], "-l"))
- {
- opt_log = GNUNET_YES;
- }
- if (0 == strcmp (argv[c], "-p"))
- {
- opt_plot = GNUNET_YES;
- }
- if (0 == strcmp (argv[c], "-v"))
- {
- opt_verbose = GNUNET_YES;
- }
- }
-}
-
-
-int
-main (int argc, char *argv[])
-{
- GNUNET_log_setup ("gnunet-ats-sim", "INFO", NULL);
-
- parse_args (argc, argv);
- if (NULL == opt_exp_file)
- {
- fprintf (stderr, "No experiment given...\n");
- return 1;
- }
-
- fprintf (stderr, "Loading experiment `%s' \n", opt_exp_file);
- e = GNUNET_ATS_TEST_experimentation_load (opt_exp_file);
- if (NULL == e)
- {
- fprintf (stderr, "Invalid experiment\n");
- return 1;
- }
- if (0 == e->num_episodes)
- {
- fprintf (stderr, "No episodes included\n");
- return 1;
- }
-
- /* Setup a topology with */
- GNUNET_ATS_TEST_create_topology ("gnunet-ats-sim", e->cfg_file,
- e->num_slaves,
- e->num_masters,
- GNUNET_NO,
- &topology_setup_done,
- NULL,
- &log_request__cb);
- GNUNET_free (opt_exp_file);
- return 0;
-}
-
-
-/* end of file gnunet-ats-sim.c */
diff --git a/src/ats-tests/gnunet-solver-eval.c b/src/ats-tests/gnunet-solver-eval.c
deleted file mode 100644
index 7a3461bf7..000000000
--- a/src/ats-tests/gnunet-solver-eval.c
+++ /dev/null
@@ -1,1025 +0,0 @@
-/*
- This file is part of GNUnet.
- Copyright (C) 2010-2013 GNUnet e.V.
-
- GNUnet is free software: you can redistribute it and/or modify it
- under the terms of the GNU Affero General Public License as published
- by the Free Software Foundation, either version 3 of the License,
- or (at your option) any later version.
-
- GNUnet is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-
- SPDX-License-Identifier: AGPL3.0-or-later
- */
-/**
- * @file ats-tests/ats-testing-experiment.c
- * @brief ats benchmark: controlled experiment execution
- * @author Christian Grothoff
- * @author Matthias Wachs
- */
-#include "platform.h"
-#include "gnunet_util_lib.h"
-#include "gnunet_ats_plugin.h"
-#include "gnunet_ats_service.h"
-#include "ats-testing.h"
-
-
-/**
- * Experiments
- */
-const char *
-print_op (enum OperationType op)
-{
- switch (op)
- {
- case START_SEND:
- return "START_SEND";
-
- case STOP_SEND:
- return "STOP_SEND";
-
- case START_PREFERENCE:
- return "START_PREFERENCE";
-
- case STOP_PREFERENCE:
- return "STOP_PREFERENCE";
-
- default:
- break;
- }
- return "";
-}
-
-
-static struct Experiment *
-create_experiment ()
-{
- struct Experiment *e;
-
- e = GNUNET_new (struct Experiment);
- e->name = NULL;
- e->num_masters = 0;
- e->num_slaves = 0;
- e->start = NULL;
- e->total_duration = GNUNET_TIME_UNIT_ZERO;
- return e;
-}
-
-
-static void
-free_experiment (struct Experiment *e)
-{
- struct Episode *cur;
- struct Episode *next;
- struct GNUNET_ATS_TEST_Operation *cur_o;
- struct GNUNET_ATS_TEST_Operation *next_o;
-
- next = e->start;
- for (cur = next; NULL != cur; cur = next)
- {
- next = cur->next;
-
- next_o = cur->head;
- for (cur_o = next_o; NULL != cur_o; cur_o = next_o)
- {
- next_o = cur_o->next;
- GNUNET_free (cur_o);
- }
- GNUNET_free (cur);
- }
-
- GNUNET_free (e->name);
- GNUNET_free (e->cfg_file);
- GNUNET_free (e);
-}
-
-
-static int
-load_episode (struct Experiment *e,
- struct Episode *cur,
- struct GNUNET_CONFIGURATION_Handle *cfg)
-{
- struct GNUNET_ATS_TEST_Operation *o;
- char *sec_name;
- char *op_name;
- char *op;
- char *type;
- char *pref;
- int op_counter = 0;
-
- fprintf (stderr, "Parsing episode %u\n", cur->id);
- GNUNET_asprintf (&sec_name, "episode-%u", cur->id);
-
- while (1)
- {
- /* Load operation */
- GNUNET_asprintf (&op_name, "op-%u-operation", op_counter);
- if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string (cfg,
- sec_name,
- op_name, &op))
- {
- GNUNET_free (op_name);
- break;
- }
- o = GNUNET_new (struct GNUNET_ATS_TEST_Operation);
- /* operations = set_rate, start_send, stop_send, set_preference */
- if (0 == strcmp (op, "start_send"))
- {
- o->type = START_SEND;
- }
- else if (0 == strcmp (op, "stop_send"))
- {
- o->type = STOP_SEND;
- }
- else if (0 == strcmp (op, "start_preference"))
- {
- o->type = START_PREFERENCE;
- }
- else if (0 == strcmp (op, "stop_preference"))
- {
- o->type = STOP_PREFERENCE;
- }
- else
- {
- fprintf (stderr, "Invalid operation %u `%s' in episode %u\n",
- op_counter, op, cur->id);
- GNUNET_free (op);
- GNUNET_free (op_name);
- GNUNET_free (sec_name);
- GNUNET_free (o);
- return GNUNET_SYSERR;
- }
- GNUNET_free (op_name);
-
- /* Get source */
- GNUNET_asprintf (&op_name, "op-%u-src", op_counter);
- if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg,
- sec_name,
- op_name,
- &o->src_id))
- {
- fprintf (stderr, "Missing src in operation %u `%s' in episode %u\n",
- op_counter, op, cur->id);
- GNUNET_free (op);
- GNUNET_free (op_name);
- GNUNET_free (sec_name);
- GNUNET_free (o);
- return GNUNET_SYSERR;
- }
- if (o->src_id > (e->num_masters - 1))
- {
- fprintf (stderr, "Invalid src %llu in operation %u `%s' in episode %u\n",
- o->src_id, op_counter, op, cur->id);
- GNUNET_free (op);
- GNUNET_free (op_name);
- GNUNET_free (sec_name);
- GNUNET_free (o);
- return GNUNET_SYSERR;
- }
- GNUNET_free (op_name);
-
- /* Get destination */
- GNUNET_asprintf (&op_name, "op-%u-dest", op_counter);
- if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg,
- sec_name,
- op_name,
- &o->dest_id))
- {
- fprintf (stderr, "Missing src in operation %u `%s' in episode %u\n",
- op_counter, op, cur->id);
- GNUNET_free (op);
- GNUNET_free (op_name);
- GNUNET_free (sec_name);
- GNUNET_free (o);
- return GNUNET_SYSERR;
- }
- if (o->dest_id > (e->num_slaves - 1))
- {
- fprintf (stderr,
- "Invalid destination %llu in operation %u `%s' in episode %u\n",
- o->dest_id,
- op_counter,
- op,
- cur->id);
- GNUNET_free (op);
- GNUNET_free (op_name);
- GNUNET_free (sec_name);
- GNUNET_free (o);
- return GNUNET_SYSERR;
- }
- GNUNET_free (op_name);
-
- GNUNET_asprintf (&op_name, "op-%u-type", op_counter);
- if ((GNUNET_SYSERR !=
- GNUNET_CONFIGURATION_get_value_string (cfg,
- sec_name,
- op_name,
- &type)) &&
- (STOP_SEND != o->type) &&
- (STOP_PREFERENCE != o->type))
- {
- /* Load arguments for set_rate, start_send, set_preference */
- if (0 == strcmp (type, "constant"))
- {
- o->gen_type = GNUNET_ATS_TEST_TG_CONSTANT;
- }
- else if (0 == strcmp (type, "linear"))
- {
- o->gen_type = GNUNET_ATS_TEST_TG_LINEAR;
- }
- else if (0 == strcmp (type, "sinus"))
- {
- o->gen_type = GNUNET_ATS_TEST_TG_SINUS;
- }
- else if (0 == strcmp (type, "random"))
- {
- o->gen_type = GNUNET_ATS_TEST_TG_RANDOM;
- }
- else
- {
- fprintf (stderr, "Invalid type %u `%s' in episode %u\n",
- op_counter, op, cur->id);
- GNUNET_free (type);
- GNUNET_free (op);
- GNUNET_free (op_name);
- GNUNET_free (sec_name);
- GNUNET_free (o);
- return GNUNET_SYSERR;
- }
- GNUNET_free (op_name);
-
- /* Get base rate */
- GNUNET_asprintf (&op_name, "op-%u-base-rate", op_counter);
- if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg,
- sec_name,
- op_name,
- &o->base_rate))
- {
- fprintf (stderr,
- "Missing base rate in operation %u `%s' in episode %u\n",
- op_counter, op, cur->id);
- GNUNET_free (type);
- GNUNET_free (op);
- GNUNET_free (op_name);
- GNUNET_free (sec_name);
- GNUNET_free (o);
- return GNUNET_SYSERR;
- }
- GNUNET_free (op_name);
-
- /* Get max rate */
- GNUNET_asprintf (&op_name, "op-%u-max-rate", op_counter);
- if (GNUNET_SYSERR ==
- GNUNET_CONFIGURATION_get_value_number (cfg,
- sec_name,
- op_name,
- &o->max_rate))
- {
- if ((GNUNET_ATS_TEST_TG_LINEAR == o->gen_type) ||
- (GNUNET_ATS_TEST_TG_RANDOM == o->gen_type) ||
- (GNUNET_ATS_TEST_TG_SINUS == o->gen_type))
- {
- fprintf (stderr,
- "Missing max rate in operation %u `%s' in episode %u\n",
- op_counter, op, cur->id);
- GNUNET_free (type);
- GNUNET_free (op_name);
- GNUNET_free (op);
- GNUNET_free (sec_name);
- GNUNET_free (o);
- return GNUNET_SYSERR;
- }
- }
- GNUNET_free (op_name);
-
- /* Get period */
- GNUNET_asprintf (&op_name, "op-%u-period", op_counter);
- if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_time (cfg,
- sec_name,
- op_name,
- &o->period))
- {
- o->period = cur->duration;
- }
- GNUNET_free (op_name);
-
- if (START_PREFERENCE == o->type)
- {
- /* Get frequency */
- GNUNET_asprintf (&op_name, "op-%u-frequency", op_counter);
- if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_time (cfg,
- sec_name,
- op_name,
- &o->frequency))
- {
- fprintf (stderr,
- "Missing frequency in operation %u `%s' in episode %u\n",
- op_counter, op, cur->id);
- GNUNET_free (type);
- GNUNET_free (op_name);
- GNUNET_free (op);
- GNUNET_free (sec_name);
- GNUNET_free (o);
- return GNUNET_SYSERR;
- }
- GNUNET_free (op_name);
-
- /* Get preference */
- GNUNET_asprintf (&op_name, "op-%u-pref", op_counter);
- if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string (cfg,
- sec_name,
- op_name,
- &pref))
- {
- fprintf (stderr,
- "Missing preference in operation %u `%s' in episode %u\n",
- op_counter, op, cur->id);
- GNUNET_free (type);
- GNUNET_free (op_name);
- GNUNET_free (op);
- GNUNET_free (sec_name);
- GNUNET_free (pref);
- GNUNET_free (o);
- return GNUNET_SYSERR;
- }
-
- if (0 == strcmp (pref, "bandwidth"))
- o->pref_type = GNUNET_ATS_PREFERENCE_BANDWIDTH;
- else if (0 == strcmp (pref, "latency"))
- o->pref_type = GNUNET_ATS_PREFERENCE_LATENCY;
- else
- {
- fprintf (stderr,
- "Invalid preference in operation %u `%s' in episode %u\n",
- op_counter,
- op,
- cur->id);
- GNUNET_free (type);
- GNUNET_free (op_name);
- GNUNET_free (op);
- GNUNET_free (sec_name);
- GNUNET_free (pref);
- GNUNET_free (o);
- return GNUNET_SYSERR;
- }
- GNUNET_free (pref);
- GNUNET_free (op_name);
- }
- }
-
- /* Safety checks */
- if ((GNUNET_ATS_TEST_TG_LINEAR == o->gen_type) ||
- (GNUNET_ATS_TEST_TG_SINUS == o->gen_type))
- {
- if ((o->max_rate - o->base_rate) > o->base_rate)
- {
- /* This will cause an underflow */
- GNUNET_break (0);
- }
- fprintf (stderr,
- "Selected max rate and base rate cannot be used for desired traffic form!\n");
- }
-
- if ((START_SEND == o->type) || (START_PREFERENCE == o->type))
- fprintf (stderr,
- "Found operation %u in episode %u: %s [%llu]->[%llu] == %s, %llu -> %llu in %s\n",
- op_counter, cur->id, print_op (o->type), o->src_id,
- o->dest_id, (NULL != type) ? type : "",
- o->base_rate, o->max_rate,
- GNUNET_STRINGS_relative_time_to_string (o->period, GNUNET_YES));
- else
- fprintf (stderr, "Found operation %u in episode %u: %s [%llu]->[%llu]\n",
- op_counter, cur->id, print_op (o->type), o->src_id, o->dest_id);
-
- GNUNET_free (type);
- GNUNET_free (op);
-
- GNUNET_CONTAINER_DLL_insert (cur->head, cur->tail, o);
- op_counter++;
- }
- GNUNET_free (sec_name);
-
- return GNUNET_OK;
-}
-
-
-static int
-load_episodes (struct Experiment *e, struct GNUNET_CONFIGURATION_Handle *cfg)
-{
- int e_counter = 0;
- char *sec_name;
- struct GNUNET_TIME_Relative e_duration;
- struct Episode *cur;
- struct Episode *last;
-
- e_counter = 0;
- last = NULL;
- while (1)
- {
- GNUNET_asprintf (&sec_name, "episode-%u", e_counter);
- if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_time (cfg,
- sec_name,
- "duration",
- &e_duration))
- {
- GNUNET_free (sec_name);
- break;
- }
-
- cur = GNUNET_new (struct Episode);
- cur->duration = e_duration;
- cur->id = e_counter;
-
- if (GNUNET_OK != load_episode (e, cur, cfg))
- {
- GNUNET_free (sec_name);
- GNUNET_free (cur);
- return GNUNET_SYSERR;
- }
-
- fprintf (stderr, "Found episode %u with duration %s \n",
- e_counter,
- GNUNET_STRINGS_relative_time_to_string (cur->duration,
- GNUNET_YES));
-
- /* Update experiment */
- e->num_episodes++;
- e->total_duration = GNUNET_TIME_relative_add (e->total_duration,
- cur->duration);
- /* Put in linked list */
- if (NULL == last)
- e->start = cur;
- else
- last->next = cur;
-
- GNUNET_free (sec_name);
- e_counter++;
- last = cur;
- }
- return e_counter;
-}
-
-
-static void
-timeout_experiment (void *cls)
-{
- struct Experiment *e = cls;
-
- e->experiment_timeout_task = NULL;
- fprintf (stderr, "Experiment timeout!\n");
-
- if (NULL != e->episode_timeout_task)
- {
- GNUNET_SCHEDULER_cancel (e->episode_timeout_task);
- e->episode_timeout_task = NULL;
- }
-
- e->e_done_cb (e, GNUNET_TIME_absolute_get_duration (e->start_time),
- GNUNET_SYSERR);
-}
-
-
-static void
-enforce_start_send (struct GNUNET_ATS_TEST_Operation *op)
-{
- /*
- struct BenchmarkPeer *peer;
- struct BenchmarkPartner *partner;
-
- peer = GNUNET_ATS_TEST_get_peer (op->src_id);
- if (NULL == peer)
- {
- GNUNET_break (0);
- return;
- }
-
- partner = GNUNET_ATS_TEST_get_partner (op->src_id, op->dest_id);
- if (NULL == partner)
- {
- GNUNET_break (0);
- return;
- }
-
- fprintf (stderr, "Found master %llu slave %llu\n",op->src_id, op->dest_id);
-
- if (NULL != partner->tg)
- {
- fprintf (stderr, "Stopping traffic between master %llu slave %llu\n",op->src_id, op->dest_id);
- GNUNET_ATS_TEST_generate_traffic_stop(partner->tg);
- partner->tg = NULL;
- }
-
- partner->tg = GNUNET_ATS_TEST_generate_traffic_start(peer, partner,
- op->tg_type, op->base_rate, op->max_rate, op->period,
- GNUNET_TIME_UNIT_FOREVER_REL);
- */}
-
-
-static void
-enforce_stop_send (struct GNUNET_ATS_TEST_Operation *op)
-{
- /*
- struct BenchmarkPartner *p;
- p = GNUNET_ATS_TEST_get_partner (op->src_id, op->dest_id);
- if (NULL == p)
- {
- GNUNET_break (0);
- return;
- }
-
- fprintf (stderr, "Found master %llu slave %llu\n",op->src_id, op->dest_id);
-
- if (NULL != p->tg)
- {
- fprintf (stderr, "Stopping traffic between master %llu slave %llu\n",
- op->src_id, op->dest_id);
- GNUNET_ATS_TEST_generate_traffic_stop(p->tg);
- p->tg = NULL;
- }
- */}
-
-
-static void
-enforce_start_preference (struct GNUNET_ATS_TEST_Operation *op)
-{
- /*
- struct BenchmarkPeer *peer;
- struct BenchmarkPartner *partner;
-
- peer = GNUNET_ATS_TEST_get_peer (op->src_id);
- if (NULL == peer)
- {
- GNUNET_break (0);
- return;
- }
-
- partner = GNUNET_ATS_TEST_get_partner (op->src_id, op->dest_id);
- if (NULL == partner)
- {
- GNUNET_break (0);
- return;
- }
-
- fprintf (stderr, "Found master %llu slave %llu\n",op->src_id, op->dest_id);
-
- if (NULL != partner->pg)
- {
- fprintf (stderr, "Stopping traffic between master %llu slave %llu\n",
- op->src_id, op->dest_id);
- GNUNET_ATS_TEST_generate_preferences_stop(partner->pg);
- partner->pg = NULL;
- }
-
- partner->pg = GNUNET_ATS_TEST_generate_preferences_start(peer, partner,
- op->tg_type, op->base_rate, op->max_rate, op->period, op->frequency,
- op->pref_type);
- */}
-
-
-static void
-enforce_stop_preference (struct GNUNET_ATS_TEST_Operation *op)
-{
- /*
- struct BenchmarkPartner *p;
- p = GNUNET_ATS_TEST_get_partner (op->src_id, op->dest_id);
- if (NULL == p)
- {
- GNUNET_break (0);
- return;
- }
-
- fprintf (stderr, "Found master %llu slave %llu\n",op->src_id, op->dest_id);
-
- if (NULL != p->pg)
- {
- fprintf (stderr, "Stopping preference between master %llu slave %llu\n",
- op->src_id, op->dest_id);
- GNUNET_ATS_TEST_generate_preferences_stop (p->pg);
- p->pg = NULL;
- }
- */}
-
-
-static void
-enforce_episode (struct Episode *ep)
-{
- struct GNUNET_ATS_TEST_Operation *cur;
-
- for (cur = ep->head; NULL != cur; cur = cur->next)
- {
- fprintf (stderr, "Enforcing operation: %s [%llu]->[%llu] == %llu\n",
- print_op (cur->type), cur->src_id, cur->dest_id, cur->base_rate);
- switch (cur->type)
- {
- case START_SEND:
- enforce_start_send (cur);
- break;
-
- case STOP_SEND:
- enforce_stop_send (cur);
- break;
-
- case START_PREFERENCE:
- enforce_start_preference (cur);
- break;
-
- case STOP_PREFERENCE:
- enforce_stop_preference (cur);
- break;
-
- default:
- break;
- }
- }
-}
-
-
-static void
-timeout_episode (void *cls)
-{
- struct Experiment *e = cls;
-
- e->episode_timeout_task = NULL;
- if (NULL != e->ep_done_cb)
- e->ep_done_cb (e->cur);
-
- /* Scheduling next */
- e->cur = e->cur->next;
- if (NULL == e->cur)
- {
- /* done */
- fprintf (stderr, "Last episode done!\n");
- if (NULL != e->experiment_timeout_task)
- {
- GNUNET_SCHEDULER_cancel (e->experiment_timeout_task);
- e->experiment_timeout_task = NULL;
- }
- e->e_done_cb (e, GNUNET_TIME_absolute_get_duration (e->start_time),
- GNUNET_OK);
- return;
- }
-
- fprintf (stderr, "Running episode %u with timeout %s\n",
- e->cur->id,
- GNUNET_STRINGS_relative_time_to_string (e->cur->duration,
- GNUNET_YES));
- enforce_episode (e->cur);
-
- e->episode_timeout_task = GNUNET_SCHEDULER_add_delayed (e->cur->duration,
- &timeout_episode, e);
-}
-
-
-void
-GNUNET_ATS_solvers_experimentation_run (struct Experiment *e,
- GNUNET_ATS_TESTING_EpisodeDoneCallback
- ep_done_cb,
- GNUNET_ATS_TESTING_ExperimentDoneCallback
- e_done_cb)
-{
- fprintf (stderr, "Running experiment `%s' with timeout %s\n", e->name,
- GNUNET_STRINGS_relative_time_to_string (e->max_duration,
- GNUNET_YES));
- e->e_done_cb = e_done_cb;
- e->ep_done_cb = ep_done_cb;
- e->start_time = GNUNET_TIME_absolute_get ();
-
- /* Start total time out */
- e->experiment_timeout_task = GNUNET_SCHEDULER_add_delayed (e->max_duration,
- &timeout_experiment,
- e);
-
- /* Start */
- e->cur = e->start;
- fprintf (stderr, "Running episode %u with timeout %s\n",
- e->cur->id,
- GNUNET_STRINGS_relative_time_to_string (e->cur->duration,
- GNUNET_YES));
- enforce_episode (e->cur);
- e->episode_timeout_task = GNUNET_SCHEDULER_add_delayed (e->cur->duration,
- &timeout_episode, e);
-}
-
-
-struct Experiment *
-GNUNET_ATS_solvers_experimentation_load (char *filename)
-{
- struct Experiment *e;
- struct GNUNET_CONFIGURATION_Handle *cfg;
-
- e = NULL;
-
- cfg = GNUNET_CONFIGURATION_create ();
- if (GNUNET_SYSERR == GNUNET_CONFIGURATION_load (cfg, filename))
- {
- fprintf (stderr, "Failed to load `%s'\n", filename);
- GNUNET_CONFIGURATION_destroy (cfg);
- return NULL;
- }
-
- e = create_experiment ();
-
- if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string (cfg, "experiment",
- "name", &e->name))
- {
- fprintf (stderr, "Invalid %s", "name");
- free_experiment (e);
- return NULL;
- }
- else
- fprintf (stderr, "Experiment name: `%s'\n", e->name);
-
- if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_filename (cfg,
- "experiment",
- "cfg_file",
- &e->cfg_file))
- {
- fprintf (stderr, "Invalid %s", "cfg_file");
- free_experiment (e);
- return NULL;
- }
- else
- fprintf (stderr, "Experiment name: `%s'\n", e->cfg_file);
-
- if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg, "experiment",
- "masters",
- &e->num_masters))
- {
- fprintf (stderr, "Invalid %s", "masters");
- free_experiment (e);
- return NULL;
- }
- else
- fprintf (stderr, "Experiment masters: `%llu'\n",
- e->num_masters);
-
- if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg, "experiment",
- "slaves",
- &e->num_slaves))
- {
- fprintf (stderr, "Invalid %s", "slaves");
- free_experiment (e);
- return NULL;
- }
- else
- fprintf (stderr, "Experiment slaves: `%llu'\n",
- e->num_slaves);
-
- if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_time (cfg, "experiment",
- "log_freq",
- &e->log_freq))
- {
- fprintf (stderr, "Invalid %s", "log_freq");
- free_experiment (e);
- return NULL;
- }
- else
- fprintf (stderr, "Experiment logging frequency: `%s'\n",
- GNUNET_STRINGS_relative_time_to_string (e->log_freq, GNUNET_YES));
-
- if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_time (cfg, "experiment",
- "max_duration",
- &e->max_duration))
- {
- fprintf (stderr, "Invalid %s", "max_duration");
- free_experiment (e);
- return NULL;
- }
- else
- fprintf (stderr, "Experiment duration: `%s'\n",
- GNUNET_STRINGS_relative_time_to_string (e->max_duration,
- GNUNET_YES));
-
- load_episodes (e, cfg);
- fprintf (stderr, "Loaded %u episodes with total duration %s\n",
- e->num_episodes,
- GNUNET_STRINGS_relative_time_to_string (e->total_duration,
- GNUNET_YES));
-
- GNUNET_CONFIGURATION_destroy (cfg);
- return e;
-}
-
-
-void
-GNUNET_ATS_solvers_experimentation_stop (struct Experiment *e)
-{
- if (NULL != e->experiment_timeout_task)
- {
- GNUNET_SCHEDULER_cancel (e->experiment_timeout_task);
- e->experiment_timeout_task = NULL;
- }
- if (NULL != e->episode_timeout_task)
- {
- GNUNET_SCHEDULER_cancel (e->episode_timeout_task);
- e->episode_timeout_task = NULL;
- }
- free_experiment (e);
-}
-
-
-/**
- * Solver
- */
-
-struct GNUNET_ATS_TESTING_SolverHandle
-{
- char *plugin;
- struct GNUNET_ATS_PluginEnvironment env;
- void *solver;
-};
-
-enum GNUNET_ATS_Solvers
-{
- GNUNET_ATS_SOLVER_PROPORTIONAL,
- GNUNET_ATS_SOLVER_MLP,
- GNUNET_ATS_SOLVER_RIL,
-};
-
-void
-GNUNET_ATS_solvers_solver_stop (struct GNUNET_ATS_TESTING_SolverHandle *sh)
-{
- GNUNET_PLUGIN_unload (sh->plugin, sh->solver);
- GNUNET_free (sh->plugin);
- GNUNET_free (sh);
-}
-
-
-struct GNUNET_ATS_TESTING_SolverHandle *
-GNUNET_ATS_solvers_solver_start (enum GNUNET_ATS_Solvers type)
-{
- struct GNUNET_ATS_TESTING_SolverHandle *sh;
- char *solver_str;
-
- switch (type)
- {
- case GNUNET_ATS_SOLVER_PROPORTIONAL:
- solver_str = "proportional";
- break;
-
- case GNUNET_ATS_SOLVER_MLP:
- solver_str = "mlp";
- break;
-
- case GNUNET_ATS_SOLVER_RIL:
- solver_str = "ril";
- break;
-
- default:
- GNUNET_break (0);
- return NULL;
- break;
- }
-
- sh = GNUNET_new (struct GNUNET_ATS_TESTING_SolverHandle);
- GNUNET_asprintf (&sh->plugin, "libgnunet_plugin_ats_%s", solver_str);
- // sh->solver = GNUNET_PLUGIN_load (sh->plugin, &sh->env);
- if (NULL == sh->solver)
- {
- fprintf (stderr, "Failed to load solver `%s'\n", sh->plugin);
- exit (1);
- }
-
- return sh;
-}
-
-
-static struct Experiment *e;
-
-static struct GNUNET_ATS_TESTING_SolverHandle *sh;
-
-/**
- * cmd option -e: experiment file
- */
-static char *opt_exp_file;
-
-static char *opt_solver;
-
-/**
- * cmd option -l: enable logging
- */
-static int opt_log;
-
-/**
- * cmd option -p: enable plots
- */
-static int opt_plot;
-
-/**
- * cmd option -v: verbose logs
- */
-static int opt_verbose;
-
-static void
-run (void *cls, char *const *args, const char *cfgfile,
- const struct GNUNET_CONFIGURATION_Handle *cfg)
-{
- enum GNUNET_ATS_Solvers solver;
-
- if (NULL == opt_exp_file)
- {
- fprintf (stderr, "No experiment given ...\n");
- exit (1);
- }
-
- if (NULL == opt_solver)
- {
- fprintf (stderr, "No solver given ...\n");
- exit (1);
- }
-
- if (0 == strcmp (opt_solver, "mlp"))
- {
- solver = GNUNET_ATS_SOLVER_MLP;
- }
- else if (0 == strcmp (opt_solver, "proportional"))
- {
- solver = GNUNET_ATS_SOLVER_PROPORTIONAL;
- }
- else if (0 == strcmp (opt_solver, "ril"))
- {
- solver = GNUNET_ATS_SOLVER_RIL;
- }
- else
- {
- fprintf (stderr, "No solver given ...");
- return;
- }
-
- /* load experiment */
- e = GNUNET_ATS_solvers_experimentation_load (opt_exp_file);
- if (NULL == e)
- {
- fprintf (stderr, "Failed to load experiment ...\n");
- return;
- }
-
- /* load solver */
- sh = GNUNET_ATS_solvers_solver_start (solver);
- if (NULL == sh)
- {
- fprintf (stderr, "Failed to start solver ...\n");
- return;
- }
-
- /* start logging */
-
- /* run experiment */
-
- /* WAIT */
-}
-
-
-/**
- * Main function of the benchmark
- *
- * @param argc argument count
- * @param argv argument values
- */
-int
-main (int argc, char *argv[])
-{
- opt_exp_file = NULL;
- opt_solver = NULL;
- opt_log = GNUNET_NO;
- opt_plot = GNUNET_NO;
-
- struct GNUNET_GETOPT_CommandLineOption options[] = {
- GNUNET_GETOPT_option_string ('s',
- "solver",
- NULL,
- gettext_noop ("solver to use"),
- &opt_solver),
-
- GNUNET_GETOPT_option_string ('e',
- "experiment",
- NULL,
- gettext_noop ("experiment to use"),
- &opt_exp_file),
-
- GNUNET_GETOPT_option_flag ('e',
- "experiment",
- gettext_noop ("experiment to use"),
- &opt_verbose),
- GNUNET_GETOPT_OPTION_END
- };
-
- if (GNUNET_OK !=
- GNUNET_PROGRAM_run (argc,
- argv, argv[0],
- NULL,
- options,
- &run, argv[0]))
- return 1;
-
- return 0;
-}
-
-
-/* end of file gnunet-solver-eval.c*/
diff --git a/src/ats-tests/gnunet_ats_sim_default.conf b/src/ats-tests/gnunet_ats_sim_default.conf
deleted file mode 100644
index a838306c3..000000000
--- a/src/ats-tests/gnunet_ats_sim_default.conf
+++ /dev/null
@@ -1,6 +0,0 @@
-@INLINE@ template_perf_ats.conf
-[transport]
-plugins = unix
-
-[ats]
-MODE = proportional
diff --git a/src/ats-tests/perf_ats.c b/src/ats-tests/perf_ats.c
deleted file mode 100644
index 64756b8aa..000000000
--- a/src/ats-tests/perf_ats.c
+++ /dev/null
@@ -1,601 +0,0 @@
-/*
- This file is part of GNUnet.
- Copyright (C) 2010-2013, 2016 GNUnet e.V.
-
- GNUnet is free software: you can redistribute it and/or modify it
- under the terms of the GNU Affero General Public License as published
- by the Free Software Foundation, either version 3 of the License,
- or (at your option) any later version.
-
- GNUnet is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-
- SPDX-License-Identifier: AGPL3.0-or-later
- */
-/**
- * @file ats/perf_ats.c
- * @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"
-#include "gnunet_testbed_service.h"
-#include "gnunet_ats_service.h"
-#include "gnunet_core_service.h"
-#include "ats-testing.h"
-
-
-#define TEST_ATS_PREFRENCE_FREQUENCY GNUNET_TIME_relative_multiply ( \
- GNUNET_TIME_UNIT_SECONDS, 1)
-#define TEST_ATS_PREFRENCE_START 1.0
-#define TEST_ATS_PREFRENCE_DELTA 1.0
-
-#define TEST_MESSAGE_FREQUENCY GNUNET_TIME_relative_multiply ( \
- GNUNET_TIME_UNIT_SECONDS, 1)
-
-#define TEST_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, \
- 120)
-#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 2
-#define DEFAULT_MASTERS_NUM 1
-
-/**
- * timeout task
- */
-static struct GNUNET_SCHEDULER_Task *timeout_task;
-
-/**
- * Progress task
- */
-static struct GNUNET_SCHEDULER_Task *progress_task;
-
-/**
- * Test result
- */
-static int result;
-
-/**
- * Test result logging
- */
-static int logging;
-
-/**
- * Test core (#GNUNET_YES) or transport (#GNUNET_NO)
- */
-static int test_core;
-
-/**
- * Solver string
- */
-static char *solver;
-
-/**
- * Preference string
- */
-static char *testname;
-
-/**
- * Preference string
- */
-static char *pref_str;
-
-/**
- * ATS preference value
- */
-static int pref_val;
-
-/**
- * Benchmark duration
- */
-static struct GNUNET_TIME_Relative perf_duration;
-
-/**
- * Logging frequency
- */
-static struct GNUNET_TIME_Relative log_frequency;
-
-/**
- * Number master peers
- */
-static unsigned int num_masters;
-
-/**
- * Array of master peers
- */
-static struct BenchmarkPeer *mps;
-
-/**
- * Number slave peers
- */
-static unsigned int num_slaves;
-
-/**
- * Array of master peers
- */
-static struct BenchmarkPeer *sps;
-
-static struct LoggingHandle *l;
-
-
-static void
-evaluate ()
-{
- int c_m;
- int c_s;
- unsigned int duration;
- struct BenchmarkPeer *mp;
- struct BenchmarkPartner *p;
-
- unsigned int kb_sent_sec;
- double kb_sent_percent;
- unsigned int kb_recv_sec;
- double kb_recv_percent;
- unsigned int rtt;
-
- duration = 1 + (perf_duration.rel_value_us / (1000 * 1000));
- for (c_m = 0; c_m < num_masters; c_m++)
- {
- mp = &mps[c_m];
- fprintf (stderr,
- "Master [%u]: sent: %u KiB in %u sec. = %u KiB/s, received: %u KiB in %u sec. = %u KiB/s\n",
- mp->no, mp->total_bytes_sent / 1024, duration,
- (mp->total_bytes_sent / 1024) / duration,
- mp->total_bytes_received / 1024, duration,
- (mp->total_bytes_received / 1024) / duration);
-
- for (c_s = 0; c_s < num_slaves; c_s++)
- {
- p = &mp->partners[c_s];
- kb_sent_sec = 0;
- kb_recv_sec = 0;
- kb_sent_percent = 0.0;
- kb_recv_percent = 0.0;
- rtt = 0;
-
- if (duration > 0)
- {
- kb_sent_sec = (p->bytes_sent / 1024) / duration;
- kb_recv_sec = (p->bytes_received / 1024) / duration;
- }
-
- if (mp->total_bytes_sent > 0)
- kb_sent_percent = ((double) p->bytes_sent * 100) / mp->total_bytes_sent;
- if (mp->total_bytes_received > 0)
- kb_recv_percent = ((double) p->bytes_received * 100)
- / mp->total_bytes_received;
- if (1000 * p->messages_sent > 0)
- rtt = p->total_app_rtt / (1000 * p->messages_sent);
- fprintf (stderr,
- "%c Master [%u] -> Slave [%u]: sent %u KiB/s (%.2f %%), received %u KiB/s (%.2f %%)\n",
- (mp->pref_partner == p->dest) ? '*' : ' ',
- mp->no, p->dest->no,
- kb_sent_sec, kb_sent_percent,
- kb_recv_sec, kb_recv_percent);
- fprintf (stderr,
- "%c Master [%u] -> Slave [%u]: Average application layer RTT: %u ms\n",
- (mp->pref_partner == p->dest) ? '*' : ' ',
- mp->no, p->dest->no, rtt);
- }
- }
-}
-
-
-/**
- * Shutdown nicely
- *
- * @param cls NULL
- */
-static void
-do_shutdown (void *cls)
-{
- if (GNUNET_YES == logging)
- GNUNET_ATS_TEST_logging_clean_up (l);
- if (NULL != timeout_task)
- {
- GNUNET_SCHEDULER_cancel (timeout_task);
- timeout_task = NULL;
- }
- if (NULL != progress_task)
- {
- fprintf (stderr, "0\n");
- GNUNET_SCHEDULER_cancel (progress_task);
- progress_task = NULL;
- }
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Benchmarking done\n");
- GNUNET_ATS_TEST_shutdown_topology ();
-}
-
-
-/**
- * Shutdown nicely
- *
- * @param cls NULL
- */
-static void
-do_timeout (void *cls)
-{
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Terminating with timeout\n");
- timeout_task = NULL;
- evaluate ();
- GNUNET_SCHEDULER_shutdown ();
-}
-
-
-static void
-print_progress (void *cls)
-{
- static int calls;
-
- progress_task = NULL;
- fprintf (stderr,
- "%llu..",
- (long long unsigned) perf_duration.rel_value_us / (1000 * 1000)
- - calls);
- calls++;
-
- progress_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
- &print_progress,
- NULL);
-}
-
-
-static void
-ats_pref_task (void *cls)
-{
- struct BenchmarkPeer *me = cls;
-
- me->ats_task = NULL;
-
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- " Master [%u] set preference for slave [%u] to %f\n",
- me->no, me->pref_partner->no, me->pref_value);
- GNUNET_ATS_performance_change_preference (me->ats_perf_handle,
- &me->pref_partner->id,
- pref_val, me->pref_value,
- GNUNET_ATS_PREFERENCE_END);
- me->pref_value += TEST_ATS_PREFRENCE_DELTA;
- me->ats_task = GNUNET_SCHEDULER_add_delayed (TEST_ATS_PREFRENCE_FREQUENCY,
- &ats_pref_task, cls);
-}
-
-
-static void
-start_benchmark (void *cls)
-{
- int c_m;
- int c_s;
-
- progress_task = GNUNET_SCHEDULER_add_now (&print_progress,
- NULL);
-
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Topology connected, start benchmarking...\n");
-
- /* Start sending test messages */
- for (c_m = 0; c_m < num_masters; c_m++)
- {
- for (c_s = 0; c_s < num_slaves; c_s++)
- {
- GNUNET_ATS_TEST_generate_traffic_start (&mps[c_m],
- &mps[c_m].partners[c_s],
- GNUNET_ATS_TEST_TG_LINEAR,
- UINT32_MAX,
- UINT32_MAX,
- GNUNET_TIME_UNIT_MINUTES,
- GNUNET_TIME_UNIT_FOREVER_REL);
- }
- if (pref_val != GNUNET_ATS_PREFERENCE_END)
- mps[c_m].ats_task = GNUNET_SCHEDULER_add_now (&ats_pref_task,
- &mps[c_m]);
- }
-
- if (GNUNET_YES == logging)
- l = GNUNET_ATS_TEST_logging_start (log_frequency,
- testname, mps,
- num_masters, num_slaves,
- GNUNET_NO);
-}
-
-
-static void
-do_benchmark (void *cls,
- struct BenchmarkPeer *masters,
- struct BenchmarkPeer *slaves)
-{
- mps = masters;
- sps = slaves;
- GNUNET_SCHEDULER_add_shutdown (&do_shutdown,
- NULL);
- timeout_task = GNUNET_SCHEDULER_add_delayed (perf_duration,
- &do_timeout,
- NULL);
- progress_task = GNUNET_SCHEDULER_add_now (&start_benchmark,
- NULL);
-}
-
-
-static struct BenchmarkPartner *
-find_partner (struct BenchmarkPeer *me,
- const struct GNUNET_PeerIdentity *peer)
-{
- int c_m;
-
- GNUNET_assert (NULL != me);
- GNUNET_assert (NULL != peer);
-
- for (c_m = 0; c_m < me->num_partners; c_m++)
- {
- /* Find a partner with other as destination */
- if (0 == GNUNET_memcmp (peer, &me->partners[c_m].dest->id))
- {
- return &me->partners[c_m];
- }
- }
- return NULL;
-}
-
-
-static void
-log_request_cb (void *cls,
- const struct GNUNET_HELLO_Address *address,
- int address_active,
- struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
- struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
- const struct GNUNET_ATS_Properties *ats)
-{
- struct BenchmarkPeer *me = cls;
- struct BenchmarkPartner *p;
- char *peer_id;
-
- p = find_partner (me, &address->peer);
- if (NULL == p)
- {
- /* This is not one of my partners
- * Will happen since the peers will connect to each other due to gossiping
- */
- return;
- }
- peer_id = GNUNET_strdup (GNUNET_i2s (&me->id));
-
- if ((p->bandwidth_in != ntohl (bandwidth_in.value__)) ||
- (p->bandwidth_out != ntohl (bandwidth_out.value__)))
- p->bandwidth_in = ntohl (bandwidth_in.value__);
- p->bandwidth_out = ntohl (bandwidth_out.value__);
-
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "%s [%u] received ATS information for peers `%s'\n",
- (GNUNET_YES == p->me->master) ? "Master" : "Slave",
- p->me->no,
- GNUNET_i2s (&p->dest->id));
-
- GNUNET_free (peer_id);
- if (NULL != l)
- GNUNET_ATS_TEST_logging_now (l);
-}
-
-
-/*
- * Start the performance test case
- */
-int
-main (int argc, char *argv[])
-{
- char *tmp;
- char *tmp_sep;
- char *test_name;
- char *conf_name;
- char *comm_name;
- char *dotexe;
- char *prefs[] = GNUNET_ATS_PreferenceTypeString;
- int c;
-
- result = 0;
-
- /* Determine testname
- * perf_ats_<solver>_<transport>_<preference>[.exe]*/
-
- /* Find test prefix, store in temp */
- tmp = strstr (argv[0], TESTNAME_PREFIX);
- if (NULL == tmp)
- {
- fprintf (stderr, "Unable to parse test name `%s'\n", argv[0]);
- return GNUNET_SYSERR;
- }
-
- /* Set tmp to end of test name prefix */
- tmp += strlen (TESTNAME_PREFIX);
-
- /* Determine solver name */
- solver = GNUNET_strdup (tmp);
- /* Remove .exe prefix */
- if ((NULL != (dotexe = strstr (solver, ".exe"))) && (dotexe[4] == '\0'))
- dotexe[0] = '\0';
-
- /* Determine first '_' after solver */
- 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';
- comm_name = GNUNET_strdup (&tmp_sep[1]);
- tmp_sep = strchr (comm_name, '_');
- 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';
- for (c = 0; c <= strlen (comm_name); c++)
- comm_name[c] = toupper (comm_name[c]);
- if (0 == strcmp (comm_name, "CORE"))
- test_core = GNUNET_YES;
- else if (0 == strcmp (comm_name, "TRANSPORT"))
- test_core = GNUNET_NO;
- else
- {
- GNUNET_free (comm_name);
- GNUNET_free (solver);
- return GNUNET_SYSERR;
- }
-
- pref_str = GNUNET_strdup (tmp_sep + 1);
-
- GNUNET_asprintf (&conf_name, "%s%s_%s.conf", TESTNAME_PREFIX, solver,
- pref_str);
- GNUNET_asprintf (&test_name, "%s%s_%s", TESTNAME_PREFIX, solver, pref_str);
-
- for (c = 0; c <= strlen (pref_str); c++)
- pref_str[c] = toupper (pref_str[c]);
- pref_val = -1;
-
- if (0 != strcmp (pref_str, "NONE"))
- {
- for (c = 0; c < GNUNET_ATS_PREFERENCE_END; c++)
- {
- if (0 == strcmp (pref_str, prefs[c]))
- {
- pref_val = c;
- break;
- }
- }
- }
- else
- {
- /* abuse terminator to indicate no pref */
- pref_val = GNUNET_ATS_PREFERENCE_END;
- }
- if (-1 == pref_val)
- {
- fprintf (stderr, "Unknown preference: `%s'\n", pref_str);
- GNUNET_free (solver);
- GNUNET_free (pref_str);
- GNUNET_free (comm_name);
- return -1;
- }
-
- for (c = 0; c < (argc - 1); c++)
- {
- if (0 == strcmp (argv[c], "-d"))
- break;
- }
- if (c < argc - 1)
- {
- if (GNUNET_OK != GNUNET_STRINGS_fancy_time_to_relative (argv[c + 1],
- &perf_duration))
- fprintf (stderr, "Failed to parse duration `%s'\n", argv[c + 1]);
- }
- else
- {
- perf_duration = BENCHMARK_DURATION;
- }
- fprintf (stderr, "Running benchmark for %llu secs\n", (unsigned long
- long) (perf_duration.
- rel_value_us)
- / (1000 * 1000));
-
- for (c = 0; c < (argc - 1); c++)
- {
- if (0 == strcmp (argv[c], "-s"))
- break;
- }
- if (c < argc - 1)
- {
- if ((0L != (num_slaves = strtol (argv[c + 1], NULL, 10)))
- && (num_slaves >= 1))
- fprintf (stderr, "Starting %u slave peers\n", num_slaves);
- else
- num_slaves = DEFAULT_SLAVES_NUM;
- }
- else
- num_slaves = DEFAULT_SLAVES_NUM;
-
- for (c = 0; c < (argc - 1); c++)
- {
- if (0 == strcmp (argv[c], "-m"))
- break;
- }
- if (c < argc - 1)
- {
- if ((0L != (num_masters = strtol (argv[c + 1], NULL, 10)))
- && (num_masters >= 2))
- fprintf (stderr, "Starting %u master peers\n", num_masters);
- else
- num_masters = DEFAULT_MASTERS_NUM;
- }
- else
- num_masters = DEFAULT_MASTERS_NUM;
-
- logging = GNUNET_NO;
- for (c = 0; c < argc; c++)
- {
- if (0 == strcmp (argv[c], "-l"))
- 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)
- {
- fprintf (stderr,
- "Number of master peers is lower than slaves! exit...\n");
- GNUNET_free (test_name);
- GNUNET_free (solver);
- GNUNET_free (pref_str);
- GNUNET_free (comm_name);
- return GNUNET_SYSERR;
- }
-
- /**
- * Setup the topology
- */
- GNUNET_ATS_TEST_create_topology ("perf-ats",
- conf_name,
- num_slaves,
- num_masters,
- test_core,
- &do_benchmark,
- NULL,
- &log_request_cb);
-
- return result;
-}
-
-
-/* end of file perf_ats.c */
diff --git a/src/ats-tests/perf_ats.h b/src/ats-tests/perf_ats.h
deleted file mode 100644
index 6460aa098..000000000
--- a/src/ats-tests/perf_ats.h
+++ /dev/null
@@ -1,256 +0,0 @@
-/*
- This file is part of GNUnet.
- Copyright (C) 2010-2013 GNUnet e.V.
-
- GNUnet is free software: you can redistribute it and/or modify it
- under the terms of the GNU Affero General Public License as published
- by the Free Software Foundation, either version 3 of the License,
- or (at your option) any later version.
-
- GNUnet is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-
- SPDX-License-Identifier: AGPL3.0-or-later
- */
-/**
- * @file ats/perf_ats.c
- * @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"
-#include "gnunet_testbed_service.h"
-#include "gnunet_ats_service.h"
-#include "gnunet_core_service.h"
-#include "ats-testing.h"
-
-#define TEST_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, \
- 120)
-#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 2
-#define DEFAULT_MASTERS_NUM 1
-
-#define TEST_ATS_PREFRENCE_FREQUENCY GNUNET_TIME_relative_multiply ( \
- GNUNET_TIME_UNIT_SECONDS, 1)
-#define TEST_ATS_PREFRENCE_START 1.0
-#define TEST_ATS_PREFRENCE_DELTA 1.0
-
-#define TEST_MESSAGE_TYPE_PING 12345
-#define TEST_MESSAGE_TYPE_PONG 12346
-#define TEST_MESSAGE_SIZE 1000
-#define TEST_MESSAGE_FREQUENCY GNUNET_TIME_relative_multiply ( \
- GNUNET_TIME_UNIT_SECONDS, 1)
-
-/**
- * Information about a benchmarking partner
- */
-struct BenchmarkPartner
-{
- /**
- * The peer itself this partner belongs to
- */
- struct BenchmarkPeer *me;
-
- /**
- * The partner peer
- */
- struct BenchmarkPeer *dest;
-
- /**
- * Core transmit handles
- */
- struct GNUNET_CORE_TransmitHandle *cth;
-
- /**
- * Transport transmit handles
- */
- struct GNUNET_TRANSPORT_TransmitHandle *tth;
-
- /**
- * Timestamp to calculate communication layer delay
- */
- struct GNUNET_TIME_Absolute last_message_sent;
-
- /**
- * Accumulated RTT for all messages
- */
- unsigned int total_app_rtt;
-
- /**
- * Number of messages sent to this partner
- */
- unsigned int messages_sent;
-
- /**
- * Number of bytes sent to this partner
- */
- unsigned int bytes_sent;
-
- /**
- * Number of messages received from this partner
- */
- unsigned int messages_received;
-
- /**
- * Number of bytes received from this partner
- */
- unsigned int bytes_received;
-
- /* Current ATS properties */
-
- uint32_t ats_distance;
-
- uint32_t ats_delay;
-
- uint32_t bandwidth_in;
-
- uint32_t bandwidth_out;
-
- uint32_t ats_utilization_up;
-
- uint32_t ats_utilization_down;
-
- uint32_t ats_network_type;
-
- uint32_t ats_cost_wan;
-
- uint32_t ats_cost_lan;
-
- uint32_t ats_cost_wlan;
-};
-
-
-/**
- * Information we track for a peer in the testbed.
- */
-struct BenchmarkPeer
-{
- /**
- * Handle with testbed.
- */
- struct GNUNET_TESTBED_Peer *peer;
-
- /**
- * Unique identifier
- */
- int no;
-
- /**
- * Is this peer a measter: GNUNET_YES/GNUNET_NO
- */
- int master;
-
- /**
- * Peer ID
- */
- struct GNUNET_PeerIdentity id;
-
- /**
- * Testbed operation to get peer information
- */
- struct GNUNET_TESTBED_Operation *peer_id_op;
-
- /**
- * Testbed operation to connect to ATS performance service
- */
- struct GNUNET_TESTBED_Operation *ats_perf_op;
-
- /**
- * Testbed operation to connect to core
- */
- struct GNUNET_TESTBED_Operation *comm_op;
-
- /**
- * ATS performance handle
- */
- struct GNUNET_ATS_PerformanceHandle *ats_perf_handle;
-
- /**
- * Masters only:
- * Testbed connect operations to connect masters to slaves
- */
- struct TestbedConnectOperation *core_connect_ops;
-
- /**
- * Core handle
- */
- struct GNUNET_CORE_Handle *ch;
-
- /**
- * Core handle
- */
- struct GNUNET_TRANSPORT_Handle *th;
-
- /**
- * Masters only:
- * Peer to set ATS preferences for
- */
- struct BenchmarkPeer *pref_partner;
-
- /**
- * Masters only
- * Progress task
- */
- struct GNUNET_SCHEDULER_Task *ats_task;
-
- /**
- * Masters only
- * Progress task
- */
- double pref_value;
-
- /**
- * Array of partners with num_slaves entries (if master) or
- * num_master entries (if slave)
- */
- struct BenchmarkPartner *partners;
-
- /**
- * Number of partners
- */
- int num_partners;
-
- /**
- * Number of core connections
- */
- int core_connections;
-
- /**
- * Masters only:
- * Number of connections to slave peers
- */
- int core_slave_connections;
-
- /**
- * Total number of messages this peer has sent
- */
- unsigned int total_messages_sent;
-
- /**
- * Total number of bytes this peer has sent
- */
- unsigned int total_bytes_sent;
-
- /**
- * Total number of messages this peer has received
- */
- unsigned int total_messages_received;
-
- /**
- * Total number of bytes this peer has received
- */
- unsigned int total_bytes_received;
-};
-
-
-/* end of file perf_ats.h */
diff --git a/src/ats-tests/perf_ats_logging.c b/src/ats-tests/perf_ats_logging.c
deleted file mode 100644
index ac8fa8950..000000000
--- a/src/ats-tests/perf_ats_logging.c
+++ /dev/null
@@ -1,780 +0,0 @@
-/*
- This file is part of GNUnet.
- Copyright (C) 2010-2013 GNUnet e.V.
-
- GNUnet is free software: you can redistribute it and/or modify it
- under the terms of the GNU Affero General Public License as published
- by the Free Software Foundation, either version 3 of the License,
- or (at your option) any later version.
-
- GNUnet is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-
- SPDX-License-Identifier: AGPL3.0-or-later
- */
-/**
- * @file ats/perf_ats_logging.c
- * @brief ats benchmark: logging for performance tests
- * @author Christian Grothoff
- * @author Matthias Wachs
- */
-#include "platform.h"
-#include "gnunet_util_lib.h"
-#include "perf_ats.h"
-
-#define THROUGHPUT_TEMPLATE "#!/usr/bin/gnuplot \n" \
- "set datafile separator ';' \n" \
- "set title \"Throughput between Master and Slaves\" \n" \
- "set xlabel \"Time in ms\" \n" \
- "set ylabel \"Bytes/s\" \n" \
- "set grid \n"
-
-#define RTT_TEMPLATE "#!/usr/bin/gnuplot \n" \
- "set datafile separator ';' \n" \
- "set title \"Application level roundtrip time between Master and Slaves\" \n" \
- "set xlabel \"Time in ms\" \n" \
- "set ylabel \"ms\" \n" \
- "set grid \n"
-
-#define BW_TEMPLATE "#!/usr/bin/gnuplot \n" \
- "set datafile separator ';' \n" \
- "set title \"Bandwidth inbound and outbound between Master and Slaves\" \n" \
- "set xlabel \"Time in ms\" \n" \
- "set ylabel \"Bytes / s \" \n" \
- "set grid \n"
-
-#define LOG_ITEMS_TIME 2
-#define LOG_ITEMS_PER_PEER 17
-
-#define LOG_ITEM_BYTES_SENT 1
-#define LOG_ITEM_MSGS_SENT 2
-#define LOG_ITEM_THROUGHPUT_SENT 3
-#define LOG_ITEM_BYTES_RECV 4
-#define LOG_ITEM_MSGS_RECV 5
-#define LOG_ITEM_THROUGHPUT_RECV 6
-#define LOG_ITEM_APP_RTT 7
-#define LOG_ITEM_ATS_BW_IN 8
-#define LOG_ITEM_ATS_BW_OUT 9
-#define LOG_ITEM_ATS_COSTS_LAN 10
-#define LOG_ITEM_ATS_WAN 11
-#define LOG_ITEM_ATS_WLAN 12
-#define LOG_ITEM_ATS_DELAY 13
-#define LOG_ITEM_ATS_DISTANCE 14
-#define LOG_ITEM_ATS_NETWORKTYPE 15
-#define LOG_ITEM_ATS_UTIL_UP 16
-#define LOG_ITEM_ATS_UTIL_DOWN 17
-
-/**
- * Logging task
- */
-static struct GNUNET_SCHEDULER_Task *log_task;
-
-/**
- * Reference to perf_ats' masters
- */
-static int num_peers;
-static int running;
-static char *name;
-static struct GNUNET_TIME_Relative frequency;
-
-/**
- * A single logging time step for a partner
- */
-struct PartnerLoggingTimestep
-{
- /**
- * Peer
- */
- struct BenchmarkPeer *slave;
-
- /**
- * Total number of messages this peer has sent
- */
- unsigned int total_messages_sent;
-
- /**
- * Total number of bytes this peer has sent
- */
- unsigned int total_bytes_sent;
-
- /**
- * Total number of messages this peer has received
- */
- unsigned int total_messages_received;
-
- /**
- * Total number of bytes this peer has received
- */
- unsigned int total_bytes_received;
-
- /**
- * Total outbound throughput for master in Bytes / s
- */
- unsigned int throughput_sent;
-
- /**
- * Total inbound throughput for master in Bytes / s
- */
- unsigned int throughput_recv;
-
- /**
- * Accumulated RTT for all messages
- */
- unsigned int total_app_rtt;
-
- /**
- * Current application level delay
- */
- unsigned int app_rtt;
-
- /* Current ATS properties */
-
- uint32_t ats_distance;
-
- uint32_t ats_delay;
-
- uint32_t bandwidth_in;
-
- uint32_t bandwidth_out;
-
- uint32_t ats_utilization_up;
-
- uint32_t ats_utilization_down;
-
- uint32_t ats_network_type;
-
- uint32_t ats_cost_wan;
-
- uint32_t ats_cost_lan;
-
- uint32_t ats_cost_wlan;
-};
-
-
-/**
- * A single logging time step for a peer
- */
-struct PeerLoggingTimestep
-{
- /**
- * Next in DLL
- */
- struct PeerLoggingTimestep *next;
-
- /**
- * Prev in DLL
- */
- struct PeerLoggingTimestep *prev;
-
- /**
- * Logging timestamp
- */
- struct GNUNET_TIME_Absolute timestamp;
-
- /**
- * Total number of messages this peer has sent
- */
- unsigned int total_messages_sent;
-
- /**
- * Total number of bytes this peer has sent
- */
- unsigned int total_bytes_sent;
-
- /**
- * Total number of messages this peer has received
- */
- unsigned int total_messages_received;
-
- /**
- * Total number of bytes this peer has received
- */
- unsigned int total_bytes_received;
-
- /**
- * Total outbound throughput for master in Bytes / s
- */
- unsigned int total_throughput_send;
-
- /**
- * Total inbound throughput for master in Bytes / s
- */
- unsigned int total_throughput_recv;
-
- /**
- * Logs for slaves
- */
- struct PartnerLoggingTimestep *slaves_log;
-};
-
-/**
- * Entry for a benchmark peer
- */
-struct LoggingPeer
-{
- /**
- * Peer
- */
- struct BenchmarkPeer *peer;
-
- /**
- * Start time
- */
- struct GNUNET_TIME_Absolute start;
-
- /**
- * DLL for logging entries: head
- */
- struct PeerLoggingTimestep *head;
-
- /**
- * DLL for logging entries: tail
- */
- struct PeerLoggingTimestep *tail;
-};
-
-/**
- * Log structure of length num_peers
- */
-static struct LoggingPeer *lp;
-
-
-static void
-write_throughput_gnuplot_script (char *fn, struct LoggingPeer *lp)
-{
- struct GNUNET_DISK_FileHandle *f;
- char *gfn;
- char *data;
- int c_s;
- int peer_index;
-
- GNUNET_asprintf (&gfn, "gnuplot_throughput_%s", fn);
- f = GNUNET_DISK_file_open (gfn,
- GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_CREATE,
- GNUNET_DISK_PERM_USER_EXEC
- | GNUNET_DISK_PERM_USER_READ
- | GNUNET_DISK_PERM_USER_WRITE);
- if (NULL == f)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot open gnuplot file `%s'\n",
- gfn);
- GNUNET_free (gfn);
- return;
- }
-
- /* Write header */
-
- if (GNUNET_SYSERR == GNUNET_DISK_file_write (f, THROUGHPUT_TEMPLATE, strlen (
- THROUGHPUT_TEMPLATE)))
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Cannot write data to plot file `%s'\n", gfn);
-
- /* Write master data */
- peer_index = LOG_ITEMS_TIME;
- GNUNET_asprintf (&data,
- "plot '%s' using 2:%u with lines title 'Master %u send total', \\\n" \
- "'%s' using 2:%u with lines title 'Master %u receive total', \\\n",
- fn, peer_index + LOG_ITEM_THROUGHPUT_SENT, lp->peer->no,
- fn, peer_index + LOG_ITEM_THROUGHPUT_RECV, lp->peer->no);
- if (GNUNET_SYSERR == GNUNET_DISK_file_write (f, data, strlen (data)))
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Cannot write data to plot file `%s'\n", gfn);
- GNUNET_free (data);
-
- peer_index = LOG_ITEMS_TIME + LOG_ITEMS_PER_PEER;
- for (c_s = 0; c_s < lp->peer->num_partners; c_s++)
- {
- GNUNET_asprintf (&data,
- "'%s' using 2:%u with lines title 'Master %u - Slave %u send', \\\n" \
- "'%s' using 2:%u with lines title 'Master %u - Slave %u receive'%s\n",
- fn, peer_index + LOG_ITEM_THROUGHPUT_SENT, lp->peer->no,
- lp->peer->partners[c_s].dest->no,
- fn, peer_index + LOG_ITEM_THROUGHPUT_RECV, lp->peer->no,
- lp->peer->partners[c_s].dest->no,
- (c_s < lp->peer->num_partners - 1) ? ", \\" :
- "\n pause -1");
- if (GNUNET_SYSERR == GNUNET_DISK_file_write (f, data, strlen (data)))
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Cannot write data to plot file `%s'\n", gfn);
- GNUNET_free (data);
- peer_index += LOG_ITEMS_PER_PEER;
- }
-
- if (GNUNET_SYSERR == GNUNET_DISK_file_close (f))
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot close gnuplot file `%s'\n",
- gfn);
- else
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Data successfully written to plot file `%s'\n", gfn);
-
- GNUNET_free (gfn);
-}
-
-
-static void
-write_rtt_gnuplot_script (char *fn, struct LoggingPeer *lp)
-{
- struct GNUNET_DISK_FileHandle *f;
- char *gfn;
- char *data;
- int c_s;
- int index;
-
- GNUNET_asprintf (&gfn, "gnuplot_rtt_%s", fn);
- f = GNUNET_DISK_file_open (gfn,
- GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_CREATE,
- GNUNET_DISK_PERM_USER_EXEC
- | GNUNET_DISK_PERM_USER_READ
- | GNUNET_DISK_PERM_USER_WRITE);
- if (NULL == f)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot open gnuplot file `%s'\n",
- gfn);
- GNUNET_free (gfn);
- return;
- }
-
- /* Write header */
-
- if (GNUNET_SYSERR == GNUNET_DISK_file_write (f, RTT_TEMPLATE, strlen (
- RTT_TEMPLATE)))
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Cannot write data to plot file `%s'\n", gfn);
-
- index = LOG_ITEMS_TIME + LOG_ITEMS_PER_PEER;
- for (c_s = 0; c_s < lp->peer->num_partners; c_s++)
- {
- GNUNET_asprintf (&data,
- "%s'%s' using 2:%u with lines title 'Master %u - Slave %u '%s\n",
- (0 == c_s) ? "plot " : "",
- fn, index + LOG_ITEM_APP_RTT, lp->peer->no,
- lp->peer->partners[c_s].dest->no,
- (c_s < lp->peer->num_partners - 1) ? ", \\" :
- "\n pause -1");
- if (GNUNET_SYSERR == GNUNET_DISK_file_write (f, data, strlen (data)))
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Cannot write data to plot file `%s'\n", gfn);
- GNUNET_free (data);
- index += LOG_ITEMS_PER_PEER;
- }
-
- if (GNUNET_SYSERR == GNUNET_DISK_file_close (f))
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot close gnuplot file `%s'\n",
- gfn);
- else
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Data successfully written to plot file `%s'\n", gfn);
- GNUNET_free (gfn);
-}
-
-
-static void
-write_bw_gnuplot_script (char *fn, struct LoggingPeer *lp)
-{
- struct GNUNET_DISK_FileHandle *f;
- char *gfn;
- char *data;
- int c_s;
- int index;
-
- GNUNET_asprintf (&gfn, "gnuplot_bw_%s", fn);
- f = GNUNET_DISK_file_open (gfn,
- GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_CREATE,
- GNUNET_DISK_PERM_USER_EXEC
- | GNUNET_DISK_PERM_USER_READ
- | GNUNET_DISK_PERM_USER_WRITE);
- if (NULL == f)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot open gnuplot file `%s'\n",
- gfn);
- GNUNET_free (gfn);
- return;
- }
-
- /* Write header */
-
- if (GNUNET_SYSERR == GNUNET_DISK_file_write (f, BW_TEMPLATE, strlen (
- BW_TEMPLATE)))
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Cannot write data to plot file `%s'\n", gfn);
-
- index = LOG_ITEMS_TIME + LOG_ITEMS_PER_PEER;
- for (c_s = 0; c_s < lp->peer->num_partners; c_s++)
- {
- GNUNET_asprintf (&data, "%s" \
- "'%s' using 2:%u with lines title 'BW out master %u - Slave %u ', \\\n" \
- "'%s' using 2:%u with lines title 'BW in master %u - Slave %u '" \
- "%s\n",
- (0 == c_s) ? "plot " : "",
- fn, index + LOG_ITEM_ATS_BW_OUT, lp->peer->no,
- lp->peer->partners[c_s].dest->no,
- fn, index + LOG_ITEM_ATS_BW_IN, lp->peer->no,
- lp->peer->partners[c_s].dest->no,
- (c_s < lp->peer->num_partners - 1) ? ", \\" :
- "\n pause -1");
- if (GNUNET_SYSERR == GNUNET_DISK_file_write (f, data, strlen (data)))
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Cannot write data to plot file `%s'\n", gfn);
- GNUNET_free (data);
- index += LOG_ITEMS_PER_PEER;
- }
-
- if (GNUNET_SYSERR == GNUNET_DISK_file_close (f))
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot close gnuplot file `%s'\n",
- gfn);
- else
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Data successfully written to plot file `%s'\n", gfn);
- GNUNET_free (gfn);
-}
-
-
-static void
-write_to_file ()
-{
- struct GNUNET_DISK_FileHandle *f;
-
- char *filename;
- char *data;
- char *slave_string;
- char *slave_string_tmp;
- struct PeerLoggingTimestep *cur_lt;
- struct PartnerLoggingTimestep *plt;
- int c_m;
- int c_s;
-
- for (c_m = 0; c_m < num_peers; c_m++)
- {
- GNUNET_asprintf (&filename, "%llu_master_%u_%s_%s.data",
- GNUNET_TIME_absolute_get ().abs_value_us,
- lp[c_m].peer->no, GNUNET_i2s (&lp[c_m].peer->id), name);
-
- f = GNUNET_DISK_file_open (filename,
- GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_CREATE,
- GNUNET_DISK_PERM_USER_READ
- | GNUNET_DISK_PERM_USER_WRITE);
- if (NULL == f)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot open log file `%s'\n",
- filename);
- GNUNET_free (filename);
- return;
- }
-
- for (cur_lt = lp[c_m].head; NULL != cur_lt; cur_lt = cur_lt->next)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Master [%u]: timestamp %llu %llu ; %u %u %u ; %u %u %u\n",
- lp[c_m].peer->no,
- cur_lt->timestamp, GNUNET_TIME_absolute_get_difference (
- lp[c_m].start, cur_lt->timestamp).rel_value_us / 1000,
- cur_lt->total_messages_sent, cur_lt->total_bytes_sent,
- cur_lt->total_throughput_send,
- cur_lt->total_messages_received, cur_lt->total_bytes_received,
- cur_lt->total_throughput_recv);
-
- slave_string = GNUNET_strdup (";");
- for (c_s = 0; c_s < lp[c_m].peer->num_partners; c_s++)
- {
- plt = &cur_lt->slaves_log[c_s];
- /* Log partners */
-
- /* Assembling slave string */
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "\t Slave [%u]: %u %u %u ; %u %u %u rtt %u delay %u bw_in %u bw_out %u \n",
- plt->slave->no,
- plt->total_messages_sent, plt->total_bytes_sent,
- plt->throughput_sent,
- plt->total_messages_received, plt->total_bytes_received,
- plt->throughput_recv,
- plt->app_rtt, plt->ats_delay,
- plt->bandwidth_in, plt->bandwidth_out);
-
- GNUNET_asprintf (&slave_string_tmp,
- "%s%u;%u;%u;%u;%u;%u;%.3f;%u;%u;%u;%u;%u;%u;%u;%u;%u;%u;",
- slave_string,
- plt->total_messages_sent, plt->total_bytes_sent,
- plt->throughput_sent,
- plt->total_messages_received,
- plt->total_bytes_received, plt->throughput_sent,
- (double) plt->app_rtt / 1000,
- plt->bandwidth_in, plt->bandwidth_out,
- plt->ats_cost_lan, plt->ats_cost_wan,
- plt->ats_cost_wlan,
- plt->ats_delay, plt->ats_distance,
- plt->ats_network_type,
- plt->ats_utilization_up, plt->ats_utilization_down);
- GNUNET_free (slave_string);
- slave_string = slave_string_tmp;
- }
- /* Assembling master string */
-
-
- GNUNET_asprintf (&data, "%llu;%llu;%u;%u;%u;%u;%u;%u;;;;;;;;;;;%s\n",
- cur_lt->timestamp,
- GNUNET_TIME_absolute_get_difference (lp[c_m].start,
- cur_lt->timestamp).
- rel_value_us / 1000,
- cur_lt->total_messages_sent, cur_lt->total_bytes_sent,
- cur_lt->total_throughput_send,
- cur_lt->total_messages_received,
- cur_lt->total_bytes_received,
- cur_lt->total_throughput_recv,
- slave_string);
- GNUNET_free (slave_string);
-
- if (GNUNET_SYSERR == GNUNET_DISK_file_write (f, data, strlen (data)))
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Cannot write data to log file `%s'\n", filename);
- GNUNET_free (data);
- }
- if (GNUNET_SYSERR == GNUNET_DISK_file_close (f))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot close log file `%s'\n",
- filename);
- GNUNET_free (filename);
- return;
- }
-
- write_throughput_gnuplot_script (filename, lp);
- write_rtt_gnuplot_script (filename, lp);
- write_bw_gnuplot_script (filename, lp);
-
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Data file successfully written to log file `%s'\n", filename);
- GNUNET_free (filename);
- }
-}
-
-
-void
-collect_log_now (void)
-{
- struct LoggingPeer *bp;
- struct PeerLoggingTimestep *mlt;
- struct PeerLoggingTimestep *prev_log_mlt;
- struct PartnerLoggingTimestep *slt;
- struct PartnerLoggingTimestep *prev_log_slt;
- struct BenchmarkPartner *p;
- struct GNUNET_TIME_Relative delta;
- int c_s;
- int c_m;
- unsigned int app_rtt;
- double mult;
-
- if (GNUNET_YES != running)
- return;
-
- for (c_m = 0; c_m < num_peers; c_m++)
- {
- bp = &lp[c_m];
- mlt = GNUNET_new (struct PeerLoggingTimestep);
- GNUNET_CONTAINER_DLL_insert_tail (bp->head, bp->tail, mlt);
- prev_log_mlt = mlt->prev;
-
- /* Collect data */
-
- /* Current master state */
- mlt->timestamp = GNUNET_TIME_absolute_get ();
- mlt->total_bytes_sent = bp->peer->total_bytes_sent;
- mlt->total_messages_sent = bp->peer->total_messages_sent;
- mlt->total_bytes_received = bp->peer->total_bytes_received;
- mlt->total_messages_received = bp->peer->total_messages_received;
-
- /* Throughput */
- if (NULL == prev_log_mlt)
- {
- /* Get difference to start */
- delta = GNUNET_TIME_absolute_get_difference (lp[c_m].start,
- mlt->timestamp);
- }
- else
- {
- /* Get difference to last timestep */
- delta = GNUNET_TIME_absolute_get_difference (mlt->prev->timestamp,
- mlt->timestamp);
- }
-
- /* Multiplication factor for throughput calculation */
- mult = (1.0 * 1000 * 1000) / (delta.rel_value_us);
-
- /* Total throughput */
- if (NULL != prev_log_mlt)
- {
- if (mlt->total_bytes_sent - mlt->prev->total_bytes_sent > 0)
- mlt->total_throughput_send = mult * (mlt->total_bytes_sent
- - mlt->prev->total_bytes_sent);
- else
- mlt->total_throughput_send = prev_log_mlt->total_throughput_send; /* no msgs send */
-
- if (mlt->total_bytes_received - mlt->prev->total_bytes_received > 0)
- mlt->total_throughput_recv = mult * (mlt->total_bytes_received
- - mlt->prev->total_bytes_received);
- else
- mlt->total_throughput_recv = prev_log_mlt->total_throughput_recv; /* no msgs received */
- }
- else
- {
- mlt->total_throughput_send = mult * mlt->total_bytes_sent;
- mlt->total_throughput_send = mult * mlt->total_bytes_received;
- }
-
- mlt->slaves_log = GNUNET_malloc (bp->peer->num_partners
- * sizeof(struct PartnerLoggingTimestep));
-
- for (c_s = 0; c_s < bp->peer->num_partners; c_s++)
- {
- p = &bp->peer->partners[c_s];
- slt = &mlt->slaves_log[c_s];
-
- slt->slave = p->dest;
- /* Bytes sent from master to this slave */
- slt->total_bytes_sent = p->bytes_sent;
- /* Messages sent from master to this slave */
- slt->total_messages_sent = p->messages_sent;
- /* Bytes master received from this slave */
- slt->total_bytes_received = p->bytes_received;
- /* Messages master received from this slave */
- slt->total_messages_received = p->messages_received;
- slt->total_app_rtt = p->total_app_rtt;
- /* ats performance information */
- slt->ats_cost_lan = p->ats_cost_lan;
- slt->ats_cost_wan = p->ats_cost_wan;
- slt->ats_cost_wlan = p->ats_cost_wlan;
- slt->ats_delay = p->ats_delay;
- slt->ats_distance = p->ats_distance;
- slt->ats_network_type = p->ats_network_type;
- slt->ats_utilization_down = p->ats_utilization_down;
- slt->ats_utilization_up = p->ats_utilization_up;
- slt->bandwidth_in = p->bandwidth_in;
- slt->bandwidth_out = p->bandwidth_out;
-
- /* Total application level rtt */
- if (NULL == prev_log_mlt)
- {
- if (0 != slt->total_messages_sent)
- app_rtt = slt->total_app_rtt / slt->total_messages_sent;
- else
- app_rtt = 0;
- }
- else
- {
- prev_log_slt = &prev_log_mlt->slaves_log[c_s];
- if ((slt->total_messages_sent - prev_log_slt->total_messages_sent) > 0)
- app_rtt = (slt->total_app_rtt - prev_log_slt->total_app_rtt)
- / (slt->total_messages_sent
- - prev_log_slt->total_messages_sent);
- else
- app_rtt = prev_log_slt->app_rtt; /* No messages were */
- }
- slt->app_rtt = app_rtt;
-
- /* Partner throughput */
- if (NULL != prev_log_mlt)
- {
- prev_log_slt = &prev_log_mlt->slaves_log[c_s];
- if (slt->total_bytes_sent - prev_log_slt->total_bytes_sent > 0)
- slt->throughput_sent = mult * (slt->total_bytes_sent
- - prev_log_slt->total_bytes_sent);
- else
- slt->throughput_sent = prev_log_slt->throughput_sent; /* no msgs send */
-
- if (slt->total_bytes_received - prev_log_slt->total_bytes_received > 0)
- slt->throughput_recv = mult * (slt->total_bytes_received
- - prev_log_slt->total_bytes_received);
- else
- slt->throughput_recv = prev_log_slt->throughput_recv; /* no msgs received */
- }
- else
- {
- slt->throughput_sent = mult * slt->total_bytes_sent;
- slt->throughput_sent = mult * slt->total_bytes_received;
- }
-
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Master [%u]: slave [%u]\n",
- bp->peer->no, p->dest->no);
- }
- }
-}
-
-
-static void
-collect_log_task (void *cls)
-{
- log_task = NULL;
- collect_log_now ();
- log_task = GNUNET_SCHEDULER_add_delayed (frequency,
- &collect_log_task, NULL);
-}
-
-
-void
-perf_logging_stop ()
-{
- int c_m;
- struct PeerLoggingTimestep *cur;
-
- if (GNUNET_YES != running)
- return;
-
- if (NULL != log_task)
- {
- GNUNET_SCHEDULER_cancel (log_task);
- log_task = NULL;
- }
- collect_log_task (NULL);
-
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- _ ("Stop logging\n"));
-
- write_to_file ();
-
- for (c_m = 0; c_m < num_peers; c_m++)
- {
- while (NULL != (cur = lp[c_m].head))
- {
- GNUNET_CONTAINER_DLL_remove (lp[c_m].head, lp[c_m].tail, cur);
- GNUNET_free (cur->slaves_log);
- GNUNET_free (cur);
- }
- }
-
- GNUNET_free (lp);
-}
-
-
-void
-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,
- _ ("Start logging `%s'\n"), testname);
-
- num_peers = num_masters;
- name = testname;
- frequency = log_frequency;
-
- lp = GNUNET_malloc (num_masters * sizeof(struct LoggingPeer));
-
- for (c_m = 0; c_m < num_masters; c_m++)
- {
- lp[c_m].peer = &masters[c_m];
- lp[c_m].start = GNUNET_TIME_absolute_get ();
- }
-
- /* Schedule logging task */
- log_task = GNUNET_SCHEDULER_add_now (&collect_log_task, NULL);
- running = GNUNET_YES;
-}
-
-
-/* end of file perf_ats_logging.c */
diff --git a/src/ats-tests/perf_ats_proportional_bandwidth.conf b/src/ats-tests/perf_ats_proportional_bandwidth.conf
deleted file mode 100644
index dba96c0fe..000000000
--- a/src/ats-tests/perf_ats_proportional_bandwidth.conf
+++ /dev/null
@@ -1,4 +0,0 @@
-@INLINE@ template_perf_ats.conf
-
-[ats]
-MODE = proportional
diff --git a/src/ats-tests/perf_ats_proportional_latency.conf b/src/ats-tests/perf_ats_proportional_latency.conf
deleted file mode 100644
index dba96c0fe..000000000
--- a/src/ats-tests/perf_ats_proportional_latency.conf
+++ /dev/null
@@ -1,4 +0,0 @@
-@INLINE@ template_perf_ats.conf
-
-[ats]
-MODE = proportional
diff --git a/src/ats-tests/perf_ats_proportional_none.conf b/src/ats-tests/perf_ats_proportional_none.conf
deleted file mode 100644
index dba96c0fe..000000000
--- a/src/ats-tests/perf_ats_proportional_none.conf
+++ /dev/null
@@ -1,4 +0,0 @@
-@INLINE@ template_perf_ats.conf
-
-[ats]
-MODE = proportional
diff --git a/src/ats-tests/template_perf_ats.conf b/src/ats-tests/template_perf_ats.conf
deleted file mode 100644
index 74f608bfb..000000000
--- a/src/ats-tests/template_perf_ats.conf
+++ /dev/null
@@ -1,52 +0,0 @@
-@INLINE@ ../../contrib/conf/gnunet/no_forcestart.conf
-
-[testbed]
-# How long should operations wait?
-OPERATION_TIMEOUT = 60 s
-
-[transport-udp]
-BROADCAST = NO
-
-[peerinfo]
-USE_INCLUDED_HELLOS = NO
-
-[transport]
-#PREFIX = valgrind --leak-check=yes
-
-[ats]
-# PREFIX = valgrind
-
-# Network specific inbound/outbound quotas
-UNSPECIFIED_QUOTA_IN = 128 KiB
-UNSPECIFIED_QUOTA_OUT = 128 KiB
-# LOOPBACK
-LOOPBACK_QUOTA_IN = 128 KiB
-LOOPBACK_QUOTA_OUT = 128 KiB
-# LAN
-LAN_QUOTA_IN = 128 KiB
-LAN_QUOTA_OUT = 128 KiB
-# WAN
-WAN_QUOTA_IN = 128 KiB
-WAN_QUOTA_OUT = 128 KiB
-# WLAN
-WLAN_QUOTA_IN = 128 KiB
-WLAN_QUOTA_OUT = 128 KiB
-# BLUETOOTH
-BLUETOOTH_QUOTA_IN = 128 KiB
-BLUETOOTH_QUOTA_OUT = 128 KiB
-
-[transport-blacklist-M1RGJB4FQSM17JJ3M9BF7Q0I8MCO8C462NMOHI26RLT7C7A2KE6HCOPRA4ARM5HPL1J9IDDK5G8SFU5GUSHCTBH90ECETK1BFQD76R0]
-HIJN5O404QNUR37OSJUTNJ6H2KJS198DHI2J3I8SE3DMKVRG1RNQPODN1IJBF14KEMPPPRM0B9F9ILFKHOFCA655CH6M5OCNCMR0FE0 =
-CDTU8QQ8UPLGHR3B91V0CLTDOHONLB8QGHGUEM2JM1GANTEV0O6T20SD2N2HDN2QSHDG6IDTBR48KRDCS601FI6VHG59E7DQA98JD2O =
-
-[transport-blacklist-93ARIS6Q347RPU9EFPS9LA00VPHQLG3RBLKEKTHV4D6UVGEAC75KIIBFB5U9KK9P9P1RU1CBPV4BSSDUTB2AL2N2LG9KSO9APQNLS0O]
-HIJN5O404QNUR37OSJUTNJ6H2KJS198DHI2J3I8SE3DMKVRG1RNQPODN1IJBF14KEMPPPRM0B9F9ILFKHOFCA655CH6M5OCNCMR0FE0 =
-CDTU8QQ8UPLGHR3B91V0CLTDOHONLB8QGHGUEM2JM1GANTEV0O6T20SD2N2HDN2QSHDG6IDTBR48KRDCS601FI6VHG59E7DQA98JD2O =
-
-[transport-blacklist-OF84RAOAU2B1SOSEHJH6350MA0F7C98U55RI76LGIQOM7O33TFHPNUFB47CDBSCOLIINMVJ2U82445ABOBQRIVREG20L31KVDV5HG60]
-HIJN5O404QNUR37OSJUTNJ6H2KJS198DHI2J3I8SE3DMKVRG1RNQPODN1IJBF14KEMPPPRM0B9F9ILFKHOFCA655CH6M5OCNCMR0FE0 =
-CDTU8QQ8UPLGHR3B91V0CLTDOHONLB8QGHGUEM2JM1GANTEV0O6T20SD2N2HDN2QSHDG6IDTBR48KRDCS601FI6VHG59E7DQA98JD2O =
-
-[transport-blacklist-548J7M14O4I0F8I84U0UFARVJ97DB6QOT3MCA8O8SNAIT5JJ8TR95LUVAP3N5L7DN33IB49SNMF3Q3C0VPLTGP9ASCULA9S2OIMHHH8]
-HIJN5O404QNUR37OSJUTNJ6H2KJS198DHI2J3I8SE3DMKVRG1RNQPODN1IJBF14KEMPPPRM0B9F9ILFKHOFCA655CH6M5OCNCMR0FE0 =
-CDTU8QQ8UPLGHR3B91V0CLTDOHONLB8QGHGUEM2JM1GANTEV0O6T20SD2N2HDN2QSHDG6IDTBR48KRDCS601FI6VHG59E7DQA98JD2O =
diff --git a/src/block/Makefile.am b/src/block/Makefile.am
index ceeff4c66..ea796bf8f 100644
--- a/src/block/Makefile.am
+++ b/src/block/Makefile.am
@@ -26,10 +26,6 @@ libgnunet_plugin_block_template_la_LIBADD = \
libgnunetblock.la \
$(top_builddir)/src/util/libgnunetutil.la \
$(LTLIBINTL)
-libgnunet_plugin_block_template_la_DEPENDENCIES = \
- libgnunetblockgroup.la \
- libgnunetblock.la \
- $(top_builddir)/src/util/libgnunetutil.la
libgnunet_plugin_block_template_la_LDFLAGS = \
$(GN_PLUGIN_LDFLAGS)
@@ -40,10 +36,6 @@ libgnunet_plugin_block_test_la_LIBADD = \
libgnunetblock.la \
$(top_builddir)/src/util/libgnunetutil.la \
$(LTLIBINTL)
-libgnunet_plugin_block_test_la_DEPENDENCIES = \
- libgnunetblockgroup.la \
- libgnunetblock.la \
- $(top_builddir)/src/util/libgnunetutil.la
libgnunet_plugin_block_test_la_LDFLAGS = \
$(GN_PLUGIN_LDFLAGS)
@@ -51,8 +43,6 @@ libgnunetblock_la_SOURCES = \
block.c
libgnunetblock_la_LIBADD = \
$(top_builddir)/src/util/libgnunetutil.la
-libgnunetblock_la_DEPENDENCIES = \
- $(top_builddir)/src/util/libgnunetutil.la
libgnunetblock_la_LDFLAGS = \
$(GN_LIB_LDFLAGS) \
$(GN_LIBINTL) \
@@ -63,9 +53,6 @@ libgnunetblockgroup_la_SOURCES = \
libgnunetblockgroup_la_LIBADD = \
libgnunetblock.la \
$(top_builddir)/src/util/libgnunetutil.la
-libgnunetblockgroup_la_DEPENDENCIES = \
- libgnunetblock.la \
- $(top_builddir)/src/util/libgnunetutil.la
libgnunetblockgroup_la_LDFLAGS = \
$(GN_LIB_LDFLAGS) \
$(GN_LIBINTL) \
diff --git a/src/dns/Makefile.am b/src/dns/Makefile.am
index 45107304b..f8672d55e 100644
--- a/src/dns/Makefile.am
+++ b/src/dns/Makefile.am
@@ -83,10 +83,6 @@ libgnunet_plugin_block_dns_la_LIBADD = \
$(top_builddir)/src/block/libgnunetblockgroup.la \
$(top_builddir)/src/block/libgnunetblock.la \
$(top_builddir)/src/util/libgnunetutil.la
-libgnunet_plugin_block_dns_la_DEPENDENCIES = \
- $(top_builddir)/src/block/libgnunetblockgroup.la \
- $(top_builddir)/src/block/libgnunetblock.la \
- $(top_builddir)/src/util/libgnunetutil.la
libgnunet_plugin_block_dns_la_LDFLAGS = \
$(GN_LIBINTL) \
$(top_builddir)/src/block/$(GN_PLUGIN_LDFLAGS)
@@ -99,5 +95,3 @@ endif
EXTRA_DIST = \
$(check_SCRIPTS)
-
-
diff --git a/src/fs/Makefile.am b/src/fs/Makefile.am
index 2400d412e..5b6ba2376 100644
--- a/src/fs/Makefile.am
+++ b/src/fs/Makefile.am
@@ -49,10 +49,6 @@ libgnunetfs_la_LIBADD = \
$(top_builddir)/src/statistics/libgnunetstatistics.la \
$(top_builddir)/src/util/libgnunetutil.la \
$(GN_LIBINTL) $(XLIB) $(LIBGCRYPT_LIBS) -lunistring
-libgnunetfs_la_DEPENDENCIES = \
- $(top_builddir)/src/datastore/libgnunetdatastore.la \
- $(top_builddir)/src/statistics/libgnunetstatistics.la \
- $(top_builddir)/src/util/libgnunetutil.la
if HAVE_LIBEXTRACTOR
libgnunetfs_la_LIBADD += \
diff --git a/src/gnsrecord/Makefile.am b/src/gnsrecord/Makefile.am
index 27f5446a1..42ac4ede4 100644
--- a/src/gnsrecord/Makefile.am
+++ b/src/gnsrecord/Makefile.am
@@ -53,8 +53,6 @@ libgnunetgnsrecord_la_LIBADD = \
$(LIBGCRYPT_LIBS) \
-lsodium \
$(GN_LIBINTL)
-libgnunetgnsrecord_la_DEPENDENCIES = \
- $(top_builddir)/src/identity/libgnunetidentity.la
libgnunetgnsrecord_la_LDFLAGS = \
$(GN_LIB_LDFLAGS) \
-version-info 0:0:0
diff --git a/src/peerinfo-tool/Makefile.am b/src/peerinfo-tool/Makefile.am
index 74af5890b..825ad5452 100644
--- a/src/peerinfo-tool/Makefile.am
+++ b/src/peerinfo-tool/Makefile.am
@@ -26,14 +26,6 @@ libgnunet_plugin_rest_peerinfo_la_LIBADD = \
$(top_builddir)/src/json/libgnunetjson.la \
$(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \
$(LTLIBINTL) -ljansson $(MHD_LIBS)
-libgnunet_plugin_rest_peerinfo_la_DEPENDENCIES = \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \
- $(top_builddir)/src/transport/libgnunettransport.la \
- $(top_builddir)/src/ats/libgnunetats.la \
- $(top_builddir)/src/rest/libgnunetrest.la \
- $(top_builddir)/src/json/libgnunetjson.la \
- $(top_builddir)/src/util/libgnunetutil.la
libgnunet_plugin_rest_peerinfo_la_LDFLAGS = \
$(GN_PLUGIN_LDFLAGS)
libgnunet_plugin_rest_peerinfo_la_CFLAGS = $(MHD_CFLAGS) $(AM_CFLAGS)
diff --git a/src/reclaim/Makefile.am b/src/reclaim/Makefile.am
index 1a0b7fae4..350d77d4b 100644
--- a/src/reclaim/Makefile.am
+++ b/src/reclaim/Makefile.am
@@ -61,14 +61,6 @@ libgnunet_plugin_rest_reclaim_la_LIBADD = \
$(top_builddir)/src/namestore/libgnunetnamestore.la \
$(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \
$(LTLIBINTL) -ljansson $(MHD_LIBS)
-libgnunet_plugin_rest_reclaim_la_DEPENDENCIES = \
- $(top_builddir)/src/identity/libgnunetidentity.la \
- libgnunetreclaim.la \
- $(top_builddir)/src/json/libgnunetjson.la \
- $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
- $(top_builddir)/src/rest/libgnunetrest.la \
- $(top_builddir)/src/namestore/libgnunetnamestore.la \
- $(top_builddir)/src/util/libgnunetutil.la
libgnunet_plugin_rest_reclaim_la_LDFLAGS = \
$(GN_PLUGIN_LDFLAGS)
libgnunet_plugin_rest_reclaim_la_CFLAGS = $(MHD_CFLAGS) $(AM_CFLAGS)
@@ -102,11 +94,6 @@ libgnunet_plugin_rest_pabc_la_LIBADD = \
$(top_builddir)/src/rest/libgnunetrest.la \
$(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \
$(LTLIBINTL) -ljansson -lpabc $(MHD_LIBS)
-libgnunet_plugin_rest_pabc_la_DEPENDENCIES = \
- libgnunetreclaim.la \
- $(top_builddir)/src/json/libgnunetjson.la \
- $(top_builddir)/src/rest/libgnunetrest.la \
- $(top_builddir)/src/util/libgnunetutil.la
libgnunet_plugin_rest_pabc_la_LDFLAGS = \
$(GN_PLUGIN_LDFLAGS)
libgnunet_plugin_rest_pabc_la_CFLAGS = $(MHD_CFLAGS) $(AM_CFLAGS)
diff --git a/src/regex/Makefile.am b/src/regex/Makefile.am
index 0b55d134f..9a7466cb2 100644
--- a/src/regex/Makefile.am
+++ b/src/regex/Makefile.am
@@ -53,9 +53,6 @@ libgnunetregex_internal_a_SOURCES = \
regex_internal_lib.h \
regex_internal.h regex_internal.c \
regex_internal_dht.c
-libgnunetregex_internal_a_DEPENDENCIES = \
- libgnunetregexblock.la
-
libgnunetregex_la_SOURCES = \
regex_api_announce.c \
diff --git a/src/revocation/Makefile.am b/src/revocation/Makefile.am
index b1a079a0d..d0c58584e 100644
--- a/src/revocation/Makefile.am
+++ b/src/revocation/Makefile.am
@@ -32,11 +32,6 @@ libgnunet_plugin_block_revocation_la_LIBADD = \
$(top_builddir)/src/util/libgnunetutil.la \
$(top_builddir)/src/identity/libgnunetidentity.la \
$(LTLIBINTL)
-libgnunet_plugin_block_revocation_la_DEPENDENCIES = \
- libgnunetrevocation.la \
- $(top_builddir)/src/block/libgnunetblockgroup.la \
- $(top_builddir)/src/block/libgnunetblock.la \
- $(top_builddir)/src/util/libgnunetutil.la
libgnunet_plugin_block_revocation_la_LDFLAGS = \
$(GN_PLUGIN_LDFLAGS)
diff --git a/src/testbed/Makefile.am b/src/testbed/Makefile.am
index d1f43f0f6..11399e77c 100644
--- a/src/testbed/Makefile.am
+++ b/src/testbed/Makefile.am
@@ -115,12 +115,6 @@ libgnunettestbed_la_LIBADD = $(XLIB) \
$(top_builddir)/src/arm/libgnunetarm.la \
$(top_builddir)/src/util/libgnunetutil.la \
$(LTLIBINTL)
-libgnunettestbed_la_DEPENDENCIES = \
- $(top_builddir)/src/statistics/libgnunetstatistics.la \
- $(top_builddir)/src/transport/libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/testing/libgnunettesting.la \
- $(top_builddir)/src/util/libgnunetutil.la
libgnunettestbed_la_LDFLAGS = \
$(GN_LIB_LDFLAGS) \
-version-info 0:0:0
diff --git a/src/testing/Makefile.am b/src/testing/Makefile.am
index c01e9bdbd..6e0f29c4e 100644
--- a/src/testing/Makefile.am
+++ b/src/testing/Makefile.am
@@ -62,9 +62,6 @@ libgnunettesting_la_LIBADD = \
$(top_builddir)/src/arm/libgnunetarm.la \
$(top_builddir)/src/util/libgnunetutil.la \
$(LTLIBINTL)
-libgnunettesting_la_DEPENDENCIES = \
- $(top_builddir)/src/arm/libgnunetarm.la \
- $(top_builddir)/src/util/libgnunetutil.la
libgnunettesting_la_LDFLAGS = \
$(GN_LIB_LDFLAGS) \
-version-info 2:0:1
diff --git a/src/testing/testing_api_cmd_netjail_start_testsystem.c b/src/testing/testing_api_cmd_netjail_start_testsystem.c
index 01bac9b05..0fe0541b0 100644
--- a/src/testing/testing_api_cmd_netjail_start_testsystem.c
+++ b/src/testing/testing_api_cmd_netjail_start_testsystem.c
@@ -191,7 +191,7 @@ struct TestingSystemCount
};
/**
-* Code to clean up ressource this cmd used.
+* Code to clean up resource this cmd used.
*
* @param cls closure
* @param cmd current CMD being cleaned up.
@@ -276,6 +276,7 @@ GNUNET_TESTING_get_trait_helper_handles (const struct
(unsigned int) 0);
}
+
/**
* Offer messages received via testing cmd helper from trait
*
@@ -362,6 +363,7 @@ helper_mst (void *cls, const struct GNUNET_MessageHeader *message)
return GNUNET_OK;
}
+
/**
* Callback called if there was an exception during execution of the helper.
*
@@ -374,6 +376,7 @@ exp_cb (void *cls)
*ns->rv = 1;
}
+
/**
* Function to initialize a init message for the helper.
*
@@ -506,7 +509,8 @@ netjail_exec_run (void *cls,
struct GNUNET_CONFIGURATION_Handle *config =
GNUNET_CONFIGURATION_create ();
- for (int i = 1; i <= atoi (ns->global_n); i++) {
+ for (int i = 1; i <= atoi (ns->global_n); i++)
+ {
for (int j = 1; j <= atoi (ns->local_m); j++)
{
sprintf (str_n, "%d", i);
@@ -554,7 +558,8 @@ netjail_start_finish (void *cls,
if (ns->number_of_peers_started == total_number)
{
- for (int i = 1; i <= atoi (ns->global_n); i++) {
+ for (int i = 1; i <= atoi (ns->global_n); i++)
+ {
for (int j = 1; j <= atoi (ns->local_m); j++)
{
tbc = GNUNET_new (struct TestingSystemCount);
diff --git a/src/testing/testing_api_cmd_netjail_stop_testsystem.c b/src/testing/testing_api_cmd_netjail_stop_testsystem.c
index d6e733e05..0ae82a26a 100644
--- a/src/testing/testing_api_cmd_netjail_stop_testsystem.c
+++ b/src/testing/testing_api_cmd_netjail_stop_testsystem.c
@@ -49,7 +49,7 @@ struct StopHelperState
/**
-* Code to clean up ressource this cmd used.
+* Code to clean up resource this cmd used.
*
* @param cls closure
* @param cmd current CMD being cleaned up.
@@ -97,7 +97,8 @@ stop_testing_system_run (void *cls,
GNUNET_TESTING_get_trait_helper_handles (start_helper_cmd,
&helper);
- for (int i = 1; i <= atoi (shs->global_n); i++) {
+ for (int i = 1; i <= atoi (shs->global_n); i++)
+ {
for (int j = 1; j <= atoi (shs->local_m); j++)
{
GNUNET_HELPER_stop (helper[(i - 1) * atoi (shs->local_m) + j - 1],
diff --git a/src/transport/Makefile.am b/src/transport/Makefile.am
index afa37bac5..70687f7b5 100644
--- a/src/transport/Makefile.am
+++ b/src/transport/Makefile.am
@@ -156,13 +156,6 @@ libgnunettransporttesting_la_LIBADD = \
$(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/arm/libgnunetarm.la \
$(GN_LIBINTL)
-libgnunettransporttesting_la_DEPENDENCIES = \
- libgnunettransport.la \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/ats/libgnunetats.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- $(top_builddir)/src/testing/libgnunettesting.la \
- $(top_builddir)/src/arm/libgnunetarm.la
libgnunettransporttesting_la_LDFLAGS = \
$(GN_LIB_LDFLAGS)
@@ -190,7 +183,8 @@ libgnunettransporttesting2_la_LIBADD = \
$(top_builddir)/src/util/libgnunetutil.la
libgnunettransporttesting2_la_LDFLAGS = \
$(GN_LIBINTL) \
- $(GN_LIB_LDFLAGS)
+ $(GN_LIB_LDFLAGS) \
+ -version-info 0:0:0
libgnunettransport_la_SOURCES = \
transport.h \
@@ -208,10 +202,6 @@ libgnunettransport_la_LIBADD = \
$(top_builddir)/src/ats/libgnunetats.la \
$(top_builddir)/src/util/libgnunetutil.la \
$(GN_LIBINTL)
-libgnunettransport_la_DEPENDENCIES = \
- $(top_builddir)/src/hello/libgnunethello.la \
- $(top_builddir)/src/ats/libgnunetats.la \
- $(top_builddir)/src/util/libgnunetutil.la
libgnunettransport_la_LDFLAGS = \
$(GN_LIB_LDFLAGS) \
-version-info 4:0:2
@@ -406,16 +396,23 @@ plugin_LTLIBRARIES = \
libgnunet_test_transport_plugin_cmd_simple_send_la_SOURCES = \
test_transport_plugin_cmd_simple_send.c
libgnunet_test_transport_plugin_cmd_simple_send_la_LIBADD = \
- $(top_builddir)/src/util/libgnunetutil.la \
+ libgnunettransporttesting2.la \
+ libgnunettransportapplication.la \
+ libgnunettransport.la \
$(top_builddir)/src/testing/libgnunettesting.la \
+ $(top_builddir)/src/peerstore/libgnunetpeerstore.la \
$(top_builddir)/src/statistics/libgnunetstatistics.la \
- libgnunettransporttesting2.la \
+ $(top_builddir)/src/hello/libgnunethello.la \
+ $(top_builddir)/src/ats/libgnunetats.la \
+ $(top_builddir)/src/arm/libgnunetarm.la \
+ $(top_builddir)/src/util/libgnunetutil.la \
$(LTLIBINTL)
libgnunet_test_transport_plugin_cmd_simple_send_la_LDFLAGS = \
$(GN_PLUGIN_LDFLAGS)
if HAVE_EXPERIMENTAL
-plugin_LTLIBRARIES += libgnunet_plugin_transport_udp.la
+plugin_LTLIBRARIES += \
+ libgnunet_plugin_transport_udp.la
endif
# Note: real plugins of course need to be added
@@ -731,8 +728,8 @@ test_transport_api_cmd_simple_send_LDADD = \
$(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/util/libgnunetutil.la \
$(top_builddir)/src/testbed/libgnunettestbed.la \
- libgnunettransport.la \
$(top_builddir)/src/hello/libgnunethello.la \
+ libgnunettransport.la \
libgnunettransporttesting.la
test_transport_testing_startstop_SOURCES = \
diff --git a/src/transport/transport_api_cmd_start_peer.c b/src/transport/transport_api_cmd_start_peer.c
index 9277bc346..729d981c0 100644
--- a/src/transport/transport_api_cmd_start_peer.c
+++ b/src/transport/transport_api_cmd_start_peer.c
@@ -69,9 +69,9 @@ hello_iter_cb (void *cb_cls,
}
-
/**
- * Function to start the retrival task to retrieve the hello of this peer from the peerstore.
+ * Function to start the retrieval task to retrieve the hello of this peer
+ * from the peerstore.
*
*/
static void
@@ -170,6 +170,7 @@ notify_connect (void *cls,
return ret;
}
+
/**
* The run method of this cmd will start all services of a peer to test the transport service.
*
@@ -309,6 +310,7 @@ start_peer_run (void *cls,
sps->rh_task = GNUNET_SCHEDULER_add_now (retrieve_hello, sps);
}
+
/**
* The cleanup function of this cmd frees resources the cmd allocated.
*
@@ -434,6 +436,7 @@ GNUNET_TRANSPORT_get_trait_hello_size (const struct
(unsigned int) 4);
}
+
/**
* Function to get the trait with the hello.
*
diff --git a/src/util/Makefile.am b/src/util/Makefile.am
index 89d040a0c..6d5307235 100644
--- a/src/util/Makefile.am
+++ b/src/util/Makefile.am
@@ -361,8 +361,6 @@ test_os_start_process_SOURCES = \
test_os_start_process.c
test_os_start_process_LDADD = \
libgnunetutil.la
-test_os_start_process_DEPENDENCIES = \
- libgnunetutil.la
test_client_nc_SOURCES = \
test_client.c