diff options
-rw-r--r-- | src/ats-tests/Makefile.am | 12 | ||||
-rw-r--r-- | src/ats-tests/ats-testing.c | 39 | ||||
-rw-r--r-- | src/ats-tests/ats-testing.h | 32 | ||||
-rw-r--r-- | src/ats-tests/gnunet-ats-sim.c | 18 | ||||
-rw-r--r-- | src/ats-tests/perf_ats.c | 87 | ||||
-rw-r--r-- | src/ats-tests/perf_ats.h | 6 |
6 files changed, 107 insertions, 87 deletions
diff --git a/src/ats-tests/Makefile.am b/src/ats-tests/Makefile.am index 22b5592a8..54c784664 100644 --- a/src/ats-tests/Makefile.am +++ b/src/ats-tests/Makefile.am | |||
@@ -52,7 +52,7 @@ noinst_PROGRAMS = \ | |||
52 | gnunet-ats-sim | 52 | gnunet-ats-sim |
53 | 53 | ||
54 | libgnunetatstesting_la_SOURCES = \ | 54 | libgnunetatstesting_la_SOURCES = \ |
55 | ats-testing.c ats-testing.h | 55 | ats-testing.c ats-testing-log.c ats-testing.h |
56 | libgnunetatstesting_la_LIBADD = \ | 56 | libgnunetatstesting_la_LIBADD = \ |
57 | $(top_builddir)/src/transport/libgnunettransport.la \ | 57 | $(top_builddir)/src/transport/libgnunettransport.la \ |
58 | $(top_builddir)/src/hello/libgnunethello.la \ | 58 | $(top_builddir)/src/hello/libgnunethello.la \ |
@@ -65,7 +65,7 @@ libgnunettransporttesting_la_LDFLAGS = \ | |||
65 | $(GN_LIB_LDFLAGS) | 65 | $(GN_LIB_LDFLAGS) |
66 | 66 | ||
67 | gnunet_ats_sim_SOURCES = \ | 67 | gnunet_ats_sim_SOURCES = \ |
68 | gnunet-ats-sim.c | 68 | gnunet-ats-sim.c |
69 | gnunet_ats_sim_LDADD = \ | 69 | gnunet_ats_sim_LDADD = \ |
70 | $(top_builddir)/src/util/libgnunetutil.la \ | 70 | $(top_builddir)/src/util/libgnunetutil.la \ |
71 | $(top_builddir)/src/ats-tests/libgnunetatstesting.la \ | 71 | $(top_builddir)/src/ats-tests/libgnunetatstesting.la \ |
@@ -79,7 +79,7 @@ gnunet_ats_sim_DEPENDENCIES = \ | |||
79 | 79 | ||
80 | 80 | ||
81 | perf_ats_proportional_core_none_SOURCES = \ | 81 | perf_ats_proportional_core_none_SOURCES = \ |
82 | perf_ats.c perf_ats_logging.c perf_ats.h | 82 | perf_ats.c |
83 | perf_ats_proportional_core_none_LDADD = \ | 83 | perf_ats_proportional_core_none_LDADD = \ |
84 | $(top_builddir)/src/util/libgnunetutil.la \ | 84 | $(top_builddir)/src/util/libgnunetutil.la \ |
85 | $(top_builddir)/src/ats-tests/libgnunetatstesting.la \ | 85 | $(top_builddir)/src/ats-tests/libgnunetatstesting.la \ |
@@ -92,7 +92,7 @@ perf_ats_proportional_core_DEPENDENCIES = \ | |||
92 | $(top_builddir)/src/util/libgnunetutil.la | 92 | $(top_builddir)/src/util/libgnunetutil.la |
93 | 93 | ||
94 | perf_ats_proportional_transport_none_SOURCES = \ | 94 | perf_ats_proportional_transport_none_SOURCES = \ |
95 | perf_ats.c perf_ats_logging.c | 95 | perf_ats.c |
96 | perf_ats_proportional_transport_none_LDADD = \ | 96 | perf_ats_proportional_transport_none_LDADD = \ |
97 | $(top_builddir)/src/util/libgnunetutil.la \ | 97 | $(top_builddir)/src/util/libgnunetutil.la \ |
98 | $(top_builddir)/src/ats-tests/libgnunetatstesting.la \ | 98 | $(top_builddir)/src/ats-tests/libgnunetatstesting.la \ |
@@ -100,9 +100,9 @@ perf_ats_proportional_transport_none_LDADD = \ | |||
100 | $(top_builddir)/src/ats/libgnunetats.la \ | 100 | $(top_builddir)/src/ats/libgnunetats.la \ |
101 | $(top_builddir)/src/core/libgnunetcore.la \ | 101 | $(top_builddir)/src/core/libgnunetcore.la \ |
102 | $(top_builddir)/src/transport/libgnunettransport.la | 102 | $(top_builddir)/src/transport/libgnunettransport.la |
103 | perf_ats_proportional_transport_DEPENDENCIES = \ | 103 | perf_ats_proportional_transport_none_DEPENDENCIES = \ |
104 | $(top_builddir)/src/ats-tests/libgnunetatstesting.la \ | 104 | $(top_builddir)/src/ats-tests/libgnunetatstesting.la \ |
105 | $(top_builddir)/src/util/libgnunetutil.la | 105 | $(top_builddir)/src/util/libgnunetutil.la |
106 | 106 | ||
107 | perf_ats_proportional_core_bandwidth_SOURCES = \ | 107 | perf_ats_proportional_core_bandwidth_SOURCES = \ |
108 | perf_ats.c perf_ats_logging.c | 108 | perf_ats.c perf_ats_logging.c |
diff --git a/src/ats-tests/ats-testing.c b/src/ats-tests/ats-testing.c index a8e451673..b93a097d9 100644 --- a/src/ats-tests/ats-testing.c +++ b/src/ats-tests/ats-testing.c | |||
@@ -18,21 +18,14 @@ | |||
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | /** | 20 | /** |
21 | * @file ats/perf_ats.c | 21 | * @file ats-tests/ats-testing.c |
22 | * @brief ats benchmark: start peers and modify preferences, monitor change over time | 22 | * @brief ats testing library: setup topology and provide logging to test ats |
23 | * solvers | ||
23 | * @author Christian Grothoff | 24 | * @author Christian Grothoff |
24 | * @author Matthias Wachs | 25 | * @author Matthias Wachs |
25 | */ | 26 | */ |
26 | #include "platform.h" | ||
27 | #include "gnunet_util_lib.h" | ||
28 | #include "gnunet_testbed_service.h" | ||
29 | #include "gnunet_ats_service.h" | ||
30 | #include "gnunet_core_service.h" | ||
31 | #include "ats-testing.h" | 27 | #include "ats-testing.h" |
32 | 28 | ||
33 | |||
34 | |||
35 | |||
36 | static struct GNUNET_ATS_TEST_Topology *top; | 29 | static struct GNUNET_ATS_TEST_Topology *top; |
37 | 30 | ||
38 | /** | 31 | /** |
@@ -48,20 +41,11 @@ do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
48 | int c_s; | 41 | int c_s; |
49 | int c_op; | 42 | int c_op; |
50 | struct BenchmarkPeer *p; | 43 | struct BenchmarkPeer *p; |
51 | /* | 44 | |
52 | if (GNUNET_YES == logging) | 45 | if (GNUNET_YES == top->logging) |
53 | perf_logging_stop(); | 46 | GNUNET_ATS_TEST_logging_stop (); |
54 | */ | 47 | |
55 | top->shutdown_task = GNUNET_SCHEDULER_NO_TASK; | 48 | top->shutdown_task = GNUNET_SCHEDULER_NO_TASK; |
56 | /* | ||
57 | if (GNUNET_SCHEDULER_NO_TASK != progress_task) | ||
58 | { | ||
59 | fprintf (stderr, "0\n"); | ||
60 | GNUNET_SCHEDULER_cancel (progress_task); | ||
61 | } | ||
62 | progress_task = GNUNET_SCHEDULER_NO_TASK; | ||
63 | */ | ||
64 | //evaluate (); | ||
65 | 49 | ||
66 | top->state.benchmarking = GNUNET_NO; | 50 | top->state.benchmarking = GNUNET_NO; |
67 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, _("Benchmarking done\n")); | 51 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, _("Benchmarking done\n")); |
@@ -604,10 +588,9 @@ main_run (void *cls, struct GNUNET_TESTBED_RunHandle *h, | |||
604 | GNUNET_assert(NULL != peers_); | 588 | GNUNET_assert(NULL != peers_); |
605 | 589 | ||
606 | top->shutdown_task = GNUNET_SCHEDULER_add_delayed ( | 590 | top->shutdown_task = GNUNET_SCHEDULER_add_delayed ( |
607 | GNUNET_TIME_relative_multiply (TEST_TIMEOUT, top->num_masters + top->num_slaves), | 591 | GNUNET_TIME_UNIT_FOREVER_REL, &do_shutdown, top); |
608 | &do_shutdown, top ); | ||
609 | 592 | ||
610 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Setting up %u masters and %u slaves\n", | 593 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Setting up %u masters and %u slaves\n", |
611 | top->num_masters, top->num_slaves); | 594 | top->num_masters, top->num_slaves); |
612 | 595 | ||
613 | /* Setup master peers */ | 596 | /* Setup master peers */ |
@@ -618,7 +601,7 @@ main_run (void *cls, struct GNUNET_TESTBED_RunHandle *h, | |||
618 | top->mps[c_m].no = c_m; | 601 | top->mps[c_m].no = c_m; |
619 | top->mps[c_m].master = GNUNET_YES; | 602 | top->mps[c_m].master = GNUNET_YES; |
620 | top->mps[c_m].pref_partner = &top->sps[c_m]; | 603 | top->mps[c_m].pref_partner = &top->sps[c_m]; |
621 | top->mps[c_m].pref_value = TEST_ATS_PREFRENCE_START; | 604 | top->mps[c_m].pref_value = TEST_ATS_PREFERENCE_DEFAULT; |
622 | top->mps[c_m].partners = | 605 | top->mps[c_m].partners = |
623 | GNUNET_malloc (top->num_slaves * sizeof (struct BenchmarkPartner)); | 606 | GNUNET_malloc (top->num_slaves * sizeof (struct BenchmarkPartner)); |
624 | top->mps[c_m].num_partners = top->num_slaves; | 607 | top->mps[c_m].num_partners = top->num_slaves; |
@@ -720,4 +703,4 @@ GNUNET_ATS_TEST_shutdown_topology (void) | |||
720 | GNUNET_SCHEDULER_shutdown(); | 703 | GNUNET_SCHEDULER_shutdown(); |
721 | } | 704 | } |
722 | 705 | ||
723 | /* end of file perf_ats.c */ | 706 | /* end of file ats-testing.c */ |
diff --git a/src/ats-tests/ats-testing.h b/src/ats-tests/ats-testing.h index ce336511e..540f2bd8c 100644 --- a/src/ats-tests/ats-testing.h +++ b/src/ats-tests/ats-testing.h | |||
@@ -18,8 +18,8 @@ | |||
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | /** | 20 | /** |
21 | * @file ats/perf_ats.c | 21 | * @file ats-tests/ats-testing.h |
22 | * @brief ats benchmark: start peers and modify preferences, monitor change over time | 22 | * @brief ats testing library: setup topology and provide logging to test ats |
23 | * @author Christian Grothoff | 23 | * @author Christian Grothoff |
24 | * @author Matthias Wachs | 24 | * @author Matthias Wachs |
25 | */ | 25 | */ |
@@ -29,21 +29,7 @@ | |||
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 | 31 | ||
32 | #define TEST_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 120) | 32 | #define TEST_ATS_PREFERENCE_DEFAULT 1.0 |
33 | #define BENCHMARK_DURATION GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10) | ||
34 | #define LOGGING_FREQUENCY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 500) | ||
35 | #define TESTNAME_PREFIX "perf_ats_" | ||
36 | #define DEFAULT_SLAVES_NUM 2 | ||
37 | #define DEFAULT_MASTERS_NUM 1 | ||
38 | |||
39 | #define TEST_ATS_PREFRENCE_FREQUENCY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1) | ||
40 | #define TEST_ATS_PREFRENCE_START 1.0 | ||
41 | #define TEST_ATS_PREFRENCE_DELTA 1.0 | ||
42 | |||
43 | #define TEST_MESSAGE_TYPE_PING 12345 | ||
44 | #define TEST_MESSAGE_TYPE_PONG 12346 | ||
45 | #define TEST_MESSAGE_SIZE 1000 | ||
46 | #define TEST_MESSAGE_FREQUENCY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1) | ||
47 | 33 | ||
48 | /** | 34 | /** |
49 | * Overall state of the performance benchmark | 35 | * Overall state of the performance benchmark |
@@ -394,6 +380,16 @@ struct GNUNET_ATS_TEST_Topology | |||
394 | }; | 380 | }; |
395 | 381 | ||
396 | void | 382 | void |
383 | GNUNET_ATS_TEST_logging_start (struct GNUNET_TIME_Relative log_frequency, | ||
384 | char * testname, struct BenchmarkPeer *masters, int num_masters); | ||
385 | |||
386 | void | ||
387 | GNUNET_ATS_TEST_logging_now (void); | ||
388 | |||
389 | void | ||
390 | GNUNET_ATS_TEST_logging_stop (void); | ||
391 | |||
392 | void | ||
397 | GNUNET_ATS_TEST_create_topology (char *name, char *cfg_file, | 393 | GNUNET_ATS_TEST_create_topology (char *name, char *cfg_file, |
398 | unsigned int num_slaves, | 394 | unsigned int num_slaves, |
399 | unsigned int num_masters, | 395 | unsigned int num_masters, |
@@ -407,4 +403,4 @@ GNUNET_ATS_TEST_create_topology (char *name, char *cfg_file, | |||
407 | void | 403 | void |
408 | GNUNET_ATS_TEST_shutdown_topology (void); | 404 | GNUNET_ATS_TEST_shutdown_topology (void); |
409 | 405 | ||
410 | /* end of file perf_ats.c */ | 406 | /* end of file ats-testing.h */ |
diff --git a/src/ats-tests/gnunet-ats-sim.c b/src/ats-tests/gnunet-ats-sim.c index 0b0e9dd7e..b394cb8a4 100644 --- a/src/ats-tests/gnunet-ats-sim.c +++ b/src/ats-tests/gnunet-ats-sim.c | |||
@@ -18,8 +18,10 @@ | |||
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | /** | 20 | /** |
21 | * @file ats/perf_ats.c | 21 | * @file ats-test/gnunet-ats-sim.c |
22 | * @brief ats benchmark: start peers and modify preferences, monitor change over time | 22 | * @brief ats traffic simulator: this tool uses the ats-test library to setup a |
23 | * topology and generate traffic between these peers. The traffic description | ||
24 | * is loaded from a experiment description file | ||
23 | * @author Christian Grothoff | 25 | * @author Christian Grothoff |
24 | * @author Matthias Wachs | 26 | * @author Matthias Wachs |
25 | */ | 27 | */ |
@@ -36,8 +38,14 @@ | |||
36 | #define TEST_MESSAGE_TYPE_PING 12345 | 38 | #define TEST_MESSAGE_TYPE_PING 12345 |
37 | #define TEST_MESSAGE_TYPE_PONG 12346 | 39 | #define TEST_MESSAGE_TYPE_PONG 12346 |
38 | 40 | ||
41 | /** | ||
42 | * Number of master peers to use | ||
43 | */ | ||
39 | static int c_masters; | 44 | static int c_masters; |
40 | 45 | ||
46 | /** | ||
47 | * Number of slave peers to use | ||
48 | */ | ||
41 | static int c_slaves; | 49 | static int c_slaves; |
42 | 50 | ||
43 | static int | 51 | static int |
@@ -76,6 +84,9 @@ static void topology_setup_done (void *cls, | |||
76 | struct BenchmarkPeer *slaves) | 84 | struct BenchmarkPeer *slaves) |
77 | { | 85 | { |
78 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Topology setup complete!\n"); | 86 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Topology setup complete!\n"); |
87 | |||
88 | |||
89 | /* Shutdown a topology with */ | ||
79 | GNUNET_ATS_TEST_shutdown_topology (); | 90 | GNUNET_ATS_TEST_shutdown_topology (); |
80 | } | 91 | } |
81 | 92 | ||
@@ -90,6 +101,7 @@ main (int argc, char *argv[]) | |||
90 | c_slaves = DEFAULT_NUM_SLAVES; | 101 | c_slaves = DEFAULT_NUM_SLAVES; |
91 | c_masters = DEFAULT_NUM_MASTERS; | 102 | c_masters = DEFAULT_NUM_MASTERS; |
92 | 103 | ||
104 | /* Setup a topology with */ | ||
93 | GNUNET_ATS_TEST_create_topology ("gnunet-ats-sim", "perf_ats_proportional_none.conf", | 105 | GNUNET_ATS_TEST_create_topology ("gnunet-ats-sim", "perf_ats_proportional_none.conf", |
94 | c_slaves, | 106 | c_slaves, |
95 | c_masters, | 107 | c_masters, |
@@ -101,4 +113,4 @@ main (int argc, char *argv[]) | |||
101 | &ats_performance_info_cb); | 113 | &ats_performance_info_cb); |
102 | return 0; | 114 | return 0; |
103 | } | 115 | } |
104 | /* end of file perf_ats_topogy.c */ | 116 | /* end of file gnunet-ats-sim.c */ |
diff --git a/src/ats-tests/perf_ats.c b/src/ats-tests/perf_ats.c index c79e291b8..53533a82a 100644 --- a/src/ats-tests/perf_ats.c +++ b/src/ats-tests/perf_ats.c | |||
@@ -40,7 +40,12 @@ | |||
40 | #define TEST_MESSAGE_SIZE 1000 | 40 | #define TEST_MESSAGE_SIZE 1000 |
41 | #define TEST_MESSAGE_FREQUENCY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1) | 41 | #define TEST_MESSAGE_FREQUENCY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1) |
42 | 42 | ||
43 | 43 | #define TEST_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 120) | |
44 | #define BENCHMARK_DURATION GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10) | ||
45 | #define LOGGING_FREQUENCY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 500) | ||
46 | #define TESTNAME_PREFIX "perf_ats_" | ||
47 | #define DEFAULT_SLAVES_NUM 2 | ||
48 | #define DEFAULT_MASTERS_NUM 1 | ||
44 | /** | 49 | /** |
45 | * Shutdown task | 50 | * Shutdown task |
46 | */ | 51 | */ |
@@ -124,6 +129,12 @@ evaluate () | |||
124 | struct BenchmarkPeer *mp; | 129 | struct BenchmarkPeer *mp; |
125 | struct BenchmarkPartner *p; | 130 | struct BenchmarkPartner *p; |
126 | 131 | ||
132 | unsigned int kb_sent_sec; | ||
133 | double kb_sent_percent; | ||
134 | unsigned int kb_recv_sec; | ||
135 | double kb_recv_percent; | ||
136 | unsigned int rtt; | ||
137 | |||
127 | duration = (perf_duration.rel_value_us / (1000 * 1000)); | 138 | duration = (perf_duration.rel_value_us / (1000 * 1000)); |
128 | for (c_m = 0; c_m < num_masters; c_m++) | 139 | for (c_m = 0; c_m < num_masters; c_m++) |
129 | { | 140 | { |
@@ -138,19 +149,35 @@ evaluate () | |||
138 | for (c_s = 0; c_s < num_slaves; c_s++) | 149 | for (c_s = 0; c_s < num_slaves; c_s++) |
139 | { | 150 | { |
140 | p = &mp->partners[c_s]; | 151 | p = &mp->partners[c_s]; |
152 | |||
153 | kb_sent_sec = 0; | ||
154 | kb_recv_sec = 0; | ||
155 | kb_sent_percent = 0.0; | ||
156 | kb_recv_percent = 0.0; | ||
157 | rtt = 0; | ||
158 | |||
159 | if (duration > 0) | ||
160 | { | ||
161 | kb_sent_percent = (p->bytes_sent / 1024) / duration; | ||
162 | kb_recv_percent = (p->bytes_received / 1024) / duration; | ||
163 | } | ||
164 | if (mp->total_bytes_sent > 0) | ||
165 | kb_sent_percent = ((double) p->bytes_sent * 100) / mp->total_bytes_sent; | ||
166 | if (mp->total_bytes_received > 0) | ||
167 | kb_recv_percent = ((double) p->bytes_received * 100) / mp->total_bytes_received; | ||
168 | if (1000 * p->messages_sent > 0) | ||
169 | rtt = p->total_app_rtt / (1000 * p->messages_sent); | ||
141 | fprintf (stderr, | 170 | fprintf (stderr, |
142 | "%c Master [%u] -> Slave [%u]: sent %u KiB/s (%.2f %%), received %u KiB/s (%.2f %%)\n", | 171 | "%c Master [%u] -> Slave [%u]: sent %u KiB/s (%.2f %%), received %u KiB/s (%.2f %%)\n", |
143 | (mp->pref_partner == p->dest) ? '*' : ' ', | 172 | (mp->pref_partner == p->dest) ? '*' : ' ', |
144 | mp->no, p->dest->no, | 173 | mp->no, p->dest->no, |
145 | (p->bytes_sent / 1024) / duration, | 174 | kb_sent_sec, kb_sent_percent, |
146 | ((double) p->bytes_sent * 100) / mp->total_bytes_sent, | 175 | kb_recv_sec, kb_recv_percent); |
147 | (p->bytes_received / 1024) / duration, | 176 | |
148 | ((double) p->bytes_received * 100) / mp->total_bytes_received ); | ||
149 | fprintf (stderr, | 177 | fprintf (stderr, |
150 | "%c Master [%u] -> Slave [%u]: Average application layer RTT: %u ms\n", | 178 | "%c Master [%u] -> Slave [%u]: Average application layer RTT: %u ms\n", |
151 | (mp->pref_partner == p->dest) ? '*' : ' ', | 179 | (mp->pref_partner == p->dest) ? '*' : ' ', |
152 | mp->no, p->dest->no, | 180 | mp->no, p->dest->no, rtt); |
153 | p->total_app_rtt / (1000 * p->messages_sent)); | ||
154 | } | 181 | } |
155 | } | 182 | } |
156 | } | 183 | } |
@@ -164,10 +191,10 @@ evaluate () | |||
164 | static void | 191 | static void |
165 | do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 192 | do_shutdown (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) |
166 | { | 193 | { |
167 | /* | 194 | |
168 | if (GNUNET_YES == logging) | 195 | if (GNUNET_YES == logging) |
169 | perf_logging_stop(); | 196 | GNUNET_ATS_TEST_logging_stop(); |
170 | */ | 197 | |
171 | shutdown_task = GNUNET_SCHEDULER_NO_TASK; | 198 | shutdown_task = GNUNET_SCHEDULER_NO_TASK; |
172 | if (GNUNET_SCHEDULER_NO_TASK != progress_task) | 199 | if (GNUNET_SCHEDULER_NO_TASK != progress_task) |
173 | { | 200 | { |
@@ -300,10 +327,8 @@ do_benchmark (void *cls, struct BenchmarkPeer *masters, struct BenchmarkPeer *sl | |||
300 | masters[c_m].ats_task = GNUNET_SCHEDULER_add_now (&ats_pref_task, &masters[c_m]); | 327 | masters[c_m].ats_task = GNUNET_SCHEDULER_add_now (&ats_pref_task, &masters[c_m]); |
301 | } | 328 | } |
302 | 329 | ||
303 | /* | ||
304 | if (GNUNET_YES == logging) | 330 | if (GNUNET_YES == logging) |
305 | perf_logging_start (log_frequency, testname, mps, num_masters); | 331 | GNUNET_ATS_TEST_logging_start (log_frequency, testname, mps, num_masters); |
306 | */ | ||
307 | } | 332 | } |
308 | 333 | ||
309 | 334 | ||
@@ -349,7 +374,6 @@ find_partner (struct BenchmarkPeer *me, const struct GNUNET_PeerIdentity * peer) | |||
349 | return &me->partners[c_m]; | 374 | return &me->partners[c_m]; |
350 | } | 375 | } |
351 | } | 376 | } |
352 | |||
353 | return NULL; | 377 | return NULL; |
354 | } | 378 | } |
355 | 379 | ||
@@ -422,11 +446,10 @@ comm_handle_pong (void *cls, const struct GNUNET_PeerIdentity *other, | |||
422 | } | 446 | } |
423 | 447 | ||
424 | 448 | ||
425 | |||
426 | static void | 449 | static void |
427 | transport_recv_cb (void *cls, | 450 | test_recv_cb (void *cls, |
428 | const struct GNUNET_PeerIdentity * peer, | 451 | const struct GNUNET_PeerIdentity * peer, |
429 | const struct GNUNET_MessageHeader * message) | 452 | const struct GNUNET_MessageHeader * message) |
430 | { | 453 | { |
431 | if (TEST_MESSAGE_SIZE != ntohs (message->size) || | 454 | if (TEST_MESSAGE_SIZE != ntohs (message->size) || |
432 | (TEST_MESSAGE_TYPE_PING != ntohs (message->type) && | 455 | (TEST_MESSAGE_TYPE_PING != ntohs (message->type) && |
@@ -442,9 +465,6 @@ transport_recv_cb (void *cls, | |||
442 | } | 465 | } |
443 | 466 | ||
444 | 467 | ||
445 | |||
446 | |||
447 | |||
448 | static void | 468 | static void |
449 | ats_performance_info_cb (void *cls, const struct GNUNET_HELLO_Address *address, | 469 | ats_performance_info_cb (void *cls, const struct GNUNET_HELLO_Address *address, |
450 | int address_active, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, | 470 | int address_active, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, |
@@ -532,17 +552,17 @@ ats_performance_info_cb (void *cls, const struct GNUNET_HELLO_Address *address, | |||
532 | break; | 552 | break; |
533 | } | 553 | } |
534 | } | 554 | } |
535 | /* | 555 | |
536 | if ((GNUNET_YES == logging) && (GNUNET_YES == log)) | 556 | if ((GNUNET_YES == logging) && (GNUNET_YES == log)) |
537 | collect_log_now(); | 557 | GNUNET_ATS_TEST_logging_now(); |
538 | */ | 558 | |
539 | GNUNET_free(peer_id); | 559 | GNUNET_free(peer_id); |
540 | } | 560 | } |
541 | 561 | ||
542 | 562 | ||
543 | 563 | /* | |
544 | 564 | * Start the performance test case | |
545 | 565 | */ | |
546 | int | 566 | int |
547 | main (int argc, char *argv[]) | 567 | main (int argc, char *argv[]) |
548 | { | 568 | { |
@@ -720,14 +740,23 @@ main (int argc, char *argv[]) | |||
720 | return GNUNET_SYSERR; | 740 | return GNUNET_SYSERR; |
721 | } | 741 | } |
722 | 742 | ||
743 | /** | ||
744 | * Core message handler to use for PING/PONG messages | ||
745 | */ | ||
723 | static struct GNUNET_CORE_MessageHandler handlers[] = { | 746 | static struct GNUNET_CORE_MessageHandler handlers[] = { |
724 | {&comm_handle_ping, TEST_MESSAGE_TYPE_PING, 0 }, | 747 | {&comm_handle_ping, TEST_MESSAGE_TYPE_PING, 0 }, |
725 | {&comm_handle_pong, TEST_MESSAGE_TYPE_PONG, 0 }, | 748 | {&comm_handle_pong, TEST_MESSAGE_TYPE_PONG, 0 }, |
726 | { NULL, 0, 0 } }; | 749 | { NULL, 0, 0 } }; |
727 | 750 | ||
751 | /** | ||
752 | * Setup the topology | ||
753 | */ | ||
728 | GNUNET_ATS_TEST_create_topology ("perf-ats", conf_name, | 754 | GNUNET_ATS_TEST_create_topology ("perf-ats", conf_name, |
729 | num_slaves, num_masters, test_core, | 755 | num_slaves, num_masters, |
730 | &do_benchmark, NULL, handlers, &transport_recv_cb, | 756 | test_core, |
757 | &do_benchmark, | ||
758 | NULL, handlers, | ||
759 | &test_recv_cb, | ||
731 | &ats_performance_info_cb); | 760 | &ats_performance_info_cb); |
732 | 761 | ||
733 | return result; | 762 | return result; |
diff --git a/src/ats-tests/perf_ats.h b/src/ats-tests/perf_ats.h index 983d30dd6..a1cd43173 100644 --- a/src/ats-tests/perf_ats.h +++ b/src/ats-tests/perf_ats.h | |||
@@ -248,13 +248,13 @@ struct BenchmarkPeer | |||
248 | 248 | ||
249 | 249 | ||
250 | void | 250 | void |
251 | collect_log_now (void); | 251 | GNUNET_ATS_TEST_logging_now (void); |
252 | 252 | ||
253 | void | 253 | void |
254 | perf_logging_stop (); | 254 | GNUNET_ATS_TEST_logging_stop (); |
255 | 255 | ||
256 | void | 256 | void |
257 | perf_logging_start (struct GNUNET_TIME_Relative log_frequency, | 257 | GNUNET_ATS_TEST_logging_start (struct GNUNET_TIME_Relative log_frequency, |
258 | char * testname, struct BenchmarkPeer *masters, int num_masters); | 258 | char * testname, struct BenchmarkPeer *masters, int num_masters); |
259 | 259 | ||
260 | 260 | ||