aboutsummaryrefslogtreecommitdiff
path: root/src/ats-tests
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2013-09-18 12:46:26 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2013-09-18 12:46:26 +0000
commitaa4697d8b58e66544daf359a1257e8ab1eb5fce8 (patch)
tree740e12f5c389ca5aa444ef5b5044fe18125c727b /src/ats-tests
parent719239c84d03b9cdaf0f608a17b0c4c9327a3e25 (diff)
remove unused variable
added basic files for logging
Diffstat (limited to 'src/ats-tests')
-rw-r--r--src/ats-tests/Makefile.am4
-rw-r--r--src/ats-tests/perf_ats.c23
-rw-r--r--src/ats-tests/perf_ats_logging.c34
-rw-r--r--src/ats-tests/perf_ats_logging.h43
4 files changed, 99 insertions, 5 deletions
diff --git a/src/ats-tests/Makefile.am b/src/ats-tests/Makefile.am
index a281f04580..1662220b79 100644
--- a/src/ats-tests/Makefile.am
+++ b/src/ats-tests/Makefile.am
@@ -48,7 +48,7 @@ TESTS = $(check_PROGRAMS)
endif
perf_ats_proportional_core_none_SOURCES = \
- perf_ats.c
+ perf_ats.c perf_ats_logging.c
perf_ats_proportional_core_none_LDADD = \
$(top_builddir)/src/util/libgnunetutil.la \
$(top_builddir)/src/testbed/libgnunettestbed.la \
@@ -57,7 +57,7 @@ perf_ats_proportional_core_none_LDADD = \
$(top_builddir)/src/transport/libgnunettransport.la
perf_ats_proportional_transport_none_SOURCES = \
- perf_ats.c
+ perf_ats.c perf_ats_logging.c
perf_ats_proportional_transport_none_LDADD = \
$(top_builddir)/src/util/libgnunetutil.la \
$(top_builddir)/src/testbed/libgnunettestbed.la \
diff --git a/src/ats-tests/perf_ats.c b/src/ats-tests/perf_ats.c
index 4757a78d2b..9f4c48f8bc 100644
--- a/src/ats-tests/perf_ats.c
+++ b/src/ats-tests/perf_ats.c
@@ -28,6 +28,7 @@
#include "gnunet_testbed_service.h"
#include "gnunet_ats_service.h"
#include "gnunet_core_service.h"
+#include "perf_ats_logging.h"
#define TEST_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10)
#define BENCHMARK_DURATION GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5)
@@ -264,6 +265,11 @@ static GNUNET_SCHEDULER_TaskIdentifier progress_task;
*/
static int result;
+/**
+ * Test result logging
+ */
+static int logging;
+
/**Test core (GNUNET_YES) or transport (GNUNET_NO)
*/
static int test_core;
@@ -353,6 +359,9 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
int c_s;
int c_op;
+ if (GNUNET_YES == logging)
+ perf_logging_stop();
+
shutdown_task = GNUNET_SCHEDULER_NO_TASK;
if (GNUNET_SCHEDULER_NO_TASK != progress_task)
{
@@ -604,6 +613,8 @@ do_benchmark ()
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)
+ perf_logging_start();
}
static void
@@ -953,8 +964,6 @@ transport_recv_cb (void *cls,
const struct GNUNET_PeerIdentity * peer,
const struct GNUNET_MessageHeader * message)
{
- struct BenchmarkPeer *me = cls;
-
if (TEST_MESSAGE_SIZE != ntohs (message->size) ||
(TEST_MESSAGE_TYPE_PING != ntohs (message->type) &&
TEST_MESSAGE_TYPE_PONG != ntohs (message->type)))
@@ -1352,6 +1361,14 @@ main (int argc, char *argv[])
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 (num_slaves < num_masters)
{
fprintf (stderr, "Number of master peers is lower than slaves! exit...\n");
@@ -1376,7 +1393,7 @@ main (int argc, char *argv[])
event_mask = 0;
event_mask |= (1LL << GNUNET_TESTBED_ET_CONNECT);
event_mask |= (1LL << GNUNET_TESTBED_ET_OPERATION_FINISHED);
- (void) GNUNET_TESTBED_test_run ("perf_ats", conf_name,
+ (void) GNUNET_TESTBED_test_run ("perf-ats", conf_name,
num_slaves + num_masters, event_mask, &controller_event_cb, NULL,
&main_run, NULL );
diff --git a/src/ats-tests/perf_ats_logging.c b/src/ats-tests/perf_ats_logging.c
new file mode 100644
index 0000000000..2342a270dc
--- /dev/null
+++ b/src/ats-tests/perf_ats_logging.c
@@ -0,0 +1,34 @@
+/*
+ This file is part of GNUnet.
+ (C) 2010-2013 Christian Grothoff (and other contributing authors)
+
+ GNUnet is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 3, 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNUnet; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+ */
+/**
+ * @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"
+
+void
+perf_logging_stop ();
+
+void
+perf_logging_start ();
+/* end of file perf_ats_logging.c */
diff --git a/src/ats-tests/perf_ats_logging.h b/src/ats-tests/perf_ats_logging.h
new file mode 100644
index 0000000000..9b93076ec4
--- /dev/null
+++ b/src/ats-tests/perf_ats_logging.h
@@ -0,0 +1,43 @@
+/*
+ This file is part of GNUnet.
+ (C) 2010-2013 Christian Grothoff (and other contributing authors)
+
+ GNUnet is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 3, 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
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNUnet; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+ */
+/**
+ * @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"
+
+void
+perf_logging_stop ()
+{
+ GNUNET_log(GNUNET_ERROR_TYPE_INFO,
+ _("Start logging\n"));
+}
+
+void
+perf_logging_start ()
+{
+ GNUNET_log(GNUNET_ERROR_TYPE_INFO,
+ _("Start logging\n"));
+}
+
+/* end of file perf_ats_logging.c */