aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 a281f0458..1662220b7 100644
--- a/src/ats-tests/Makefile.am
+++ b/src/ats-tests/Makefile.am
@@ -48,7 +48,7 @@ TESTS = $(check_PROGRAMS)
48endif 48endif
49 49
50perf_ats_proportional_core_none_SOURCES = \ 50perf_ats_proportional_core_none_SOURCES = \
51 perf_ats.c 51 perf_ats.c perf_ats_logging.c
52perf_ats_proportional_core_none_LDADD = \ 52perf_ats_proportional_core_none_LDADD = \
53 $(top_builddir)/src/util/libgnunetutil.la \ 53 $(top_builddir)/src/util/libgnunetutil.la \
54 $(top_builddir)/src/testbed/libgnunettestbed.la \ 54 $(top_builddir)/src/testbed/libgnunettestbed.la \
@@ -57,7 +57,7 @@ perf_ats_proportional_core_none_LDADD = \
57 $(top_builddir)/src/transport/libgnunettransport.la 57 $(top_builddir)/src/transport/libgnunettransport.la
58 58
59perf_ats_proportional_transport_none_SOURCES = \ 59perf_ats_proportional_transport_none_SOURCES = \
60 perf_ats.c 60 perf_ats.c perf_ats_logging.c
61perf_ats_proportional_transport_none_LDADD = \ 61perf_ats_proportional_transport_none_LDADD = \
62 $(top_builddir)/src/util/libgnunetutil.la \ 62 $(top_builddir)/src/util/libgnunetutil.la \
63 $(top_builddir)/src/testbed/libgnunettestbed.la \ 63 $(top_builddir)/src/testbed/libgnunettestbed.la \
diff --git a/src/ats-tests/perf_ats.c b/src/ats-tests/perf_ats.c
index 4757a78d2..9f4c48f8b 100644
--- a/src/ats-tests/perf_ats.c
+++ b/src/ats-tests/perf_ats.c
@@ -28,6 +28,7 @@
28#include "gnunet_testbed_service.h" 28#include "gnunet_testbed_service.h"
29#include "gnunet_ats_service.h" 29#include "gnunet_ats_service.h"
30#include "gnunet_core_service.h" 30#include "gnunet_core_service.h"
31#include "perf_ats_logging.h"
31 32
32#define TEST_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10) 33#define TEST_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10)
33#define BENCHMARK_DURATION GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5) 34#define BENCHMARK_DURATION GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5)
@@ -264,6 +265,11 @@ static GNUNET_SCHEDULER_TaskIdentifier progress_task;
264 */ 265 */
265static int result; 266static int result;
266 267
268/**
269 * Test result logging
270 */
271static int logging;
272
267/**Test core (GNUNET_YES) or transport (GNUNET_NO) 273/**Test core (GNUNET_YES) or transport (GNUNET_NO)
268 */ 274 */
269static int test_core; 275static int test_core;
@@ -353,6 +359,9 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
353 int c_s; 359 int c_s;
354 int c_op; 360 int c_op;
355 361
362 if (GNUNET_YES == logging)
363 perf_logging_stop();
364
356 shutdown_task = GNUNET_SCHEDULER_NO_TASK; 365 shutdown_task = GNUNET_SCHEDULER_NO_TASK;
357 if (GNUNET_SCHEDULER_NO_TASK != progress_task) 366 if (GNUNET_SCHEDULER_NO_TASK != progress_task)
358 { 367 {
@@ -604,6 +613,8 @@ do_benchmark ()
604 if (pref_val != GNUNET_ATS_PREFERENCE_END) 613 if (pref_val != GNUNET_ATS_PREFERENCE_END)
605 mps[c_m].ats_task = GNUNET_SCHEDULER_add_now (&ats_pref_task, &mps[c_m]); 614 mps[c_m].ats_task = GNUNET_SCHEDULER_add_now (&ats_pref_task, &mps[c_m]);
606 } 615 }
616 if (GNUNET_YES == logging)
617 perf_logging_start();
607} 618}
608 619
609static void 620static void
@@ -953,8 +964,6 @@ transport_recv_cb (void *cls,
953 const struct GNUNET_PeerIdentity * peer, 964 const struct GNUNET_PeerIdentity * peer,
954 const struct GNUNET_MessageHeader * message) 965 const struct GNUNET_MessageHeader * message)
955{ 966{
956 struct BenchmarkPeer *me = cls;
957
958 if (TEST_MESSAGE_SIZE != ntohs (message->size) || 967 if (TEST_MESSAGE_SIZE != ntohs (message->size) ||
959 (TEST_MESSAGE_TYPE_PING != ntohs (message->type) && 968 (TEST_MESSAGE_TYPE_PING != ntohs (message->type) &&
960 TEST_MESSAGE_TYPE_PONG != ntohs (message->type))) 969 TEST_MESSAGE_TYPE_PONG != ntohs (message->type)))
@@ -1352,6 +1361,14 @@ main (int argc, char *argv[])
1352 else 1361 else
1353 num_masters = DEFAULT_MASTERS_NUM; 1362 num_masters = DEFAULT_MASTERS_NUM;
1354 1363
1364 logging = GNUNET_NO;
1365 for (c = 0; c < argc; c++)
1366 {
1367 if (0 == strcmp (argv[c], "-l"))
1368 logging = GNUNET_YES;
1369 }
1370
1371
1355 if (num_slaves < num_masters) 1372 if (num_slaves < num_masters)
1356 { 1373 {
1357 fprintf (stderr, "Number of master peers is lower than slaves! exit...\n"); 1374 fprintf (stderr, "Number of master peers is lower than slaves! exit...\n");
@@ -1376,7 +1393,7 @@ main (int argc, char *argv[])
1376 event_mask = 0; 1393 event_mask = 0;
1377 event_mask |= (1LL << GNUNET_TESTBED_ET_CONNECT); 1394 event_mask |= (1LL << GNUNET_TESTBED_ET_CONNECT);
1378 event_mask |= (1LL << GNUNET_TESTBED_ET_OPERATION_FINISHED); 1395 event_mask |= (1LL << GNUNET_TESTBED_ET_OPERATION_FINISHED);
1379 (void) GNUNET_TESTBED_test_run ("perf_ats", conf_name, 1396 (void) GNUNET_TESTBED_test_run ("perf-ats", conf_name,
1380 num_slaves + num_masters, event_mask, &controller_event_cb, NULL, 1397 num_slaves + num_masters, event_mask, &controller_event_cb, NULL,
1381 &main_run, NULL ); 1398 &main_run, NULL );
1382 1399
diff --git a/src/ats-tests/perf_ats_logging.c b/src/ats-tests/perf_ats_logging.c
new file mode 100644
index 000000000..2342a270d
--- /dev/null
+++ b/src/ats-tests/perf_ats_logging.c
@@ -0,0 +1,34 @@
1/*
2 This file is part of GNUnet.
3 (C) 2010-2013 Christian Grothoff (and other contributing authors)
4
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19 */
20/**
21 * @file ats/perf_ats_logging.c
22 * @brief ats benchmark: logging for performance tests
23 * @author Christian Grothoff
24 * @author Matthias Wachs
25 */
26#include "platform.h"
27#include "gnunet_util_lib.h"
28
29void
30perf_logging_stop ();
31
32void
33perf_logging_start ();
34/* 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 000000000..9b93076ec
--- /dev/null
+++ b/src/ats-tests/perf_ats_logging.h
@@ -0,0 +1,43 @@
1/*
2 This file is part of GNUnet.
3 (C) 2010-2013 Christian Grothoff (and other contributing authors)
4
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19 */
20/**
21 * @file ats/perf_ats_logging.c
22 * @brief ats benchmark: logging for performance tests
23 * @author Christian Grothoff
24 * @author Matthias Wachs
25 */
26#include "platform.h"
27#include "gnunet_util_lib.h"
28
29void
30perf_logging_stop ()
31{
32 GNUNET_log(GNUNET_ERROR_TYPE_INFO,
33 _("Start logging\n"));
34}
35
36void
37perf_logging_start ()
38{
39 GNUNET_log(GNUNET_ERROR_TYPE_INFO,
40 _("Start logging\n"));
41}
42
43/* end of file perf_ats_logging.c */