aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2014-03-13 15:01:40 +0000
committerBart Polot <bart@net.in.tum.de>2014-03-13 15:01:40 +0000
commitb06de9fad684e2e657329d2d395b9c639e74acac (patch)
tree06052917ef0d20ec59795025fcdc53812b3007db /src
parent6c814b8eb899ebbe3d0ea269aafa46b01aaeedbc (diff)
downloadgnunet-b06de9fad684e2e657329d2d395b9c639e74acac.tar.gz
gnunet-b06de9fad684e2e657329d2d395b9c639e74acac.zip
- fix compilation issues, add to Makefile
Diffstat (limited to 'src')
-rw-r--r--src/mesh/Makefile.am9
-rw-r--r--src/mesh/mesh_profiler.c45
2 files changed, 30 insertions, 24 deletions
diff --git a/src/mesh/Makefile.am b/src/mesh/Makefile.am
index a2bb0135b..75bb03a87 100644
--- a/src/mesh/Makefile.am
+++ b/src/mesh/Makefile.am
@@ -84,6 +84,7 @@ endif
84 84
85if HAVE_TESTING 85if HAVE_TESTING
86 noinst_LIBRARIES = libgnunetmeshtest.a $(noinst_LIB_EXP) 86 noinst_LIBRARIES = libgnunetmeshtest.a $(noinst_LIB_EXP)
87 noinst_PROGRAMS = gnunet-mesh-profiler
87endif 88endif
88 89
89libgnunetmeshtest_a_SOURCES = \ 90libgnunetmeshtest_a_SOURCES = \
@@ -117,12 +118,18 @@ ld_mesh_test_lib = \
117 $(top_builddir)/src/testbed/libgnunettestbed.la \ 118 $(top_builddir)/src/testbed/libgnunettestbed.la \
118 $(top_builddir)/src/statistics/libgnunetstatistics.la 119 $(top_builddir)/src/statistics/libgnunetstatistics.la
119 120
120
121dep_mesh_test_lib = \ 121dep_mesh_test_lib = \
122 libgnunetmesh.la \ 122 libgnunetmesh.la \
123 libgnunetmeshtest.a \ 123 libgnunetmeshtest.a \
124 $(top_builddir)/src/statistics/libgnunetstatistics.la 124 $(top_builddir)/src/statistics/libgnunetstatistics.la
125 125
126
127gnunet_mesh_profiler_SOURCES = \
128 mesh_profiler.c
129gnunet_mesh_profiler_LDADD = $(ld_mesh_test_lib)
130gnunet_mesh_profiler_DEPENDENCIES = $(dep_mesh_test_lib)
131
132
126test_mesh_single_SOURCES = \ 133test_mesh_single_SOURCES = \
127 test_mesh_single.c 134 test_mesh_single.c
128test_mesh_single_LDADD = $(ld_mesh_test_lib) 135test_mesh_single_LDADD = $(ld_mesh_test_lib)
diff --git a/src/mesh/mesh_profiler.c b/src/mesh/mesh_profiler.c
index 2eebeccde..fd360c34b 100644
--- a/src/mesh/mesh_profiler.c
+++ b/src/mesh/mesh_profiler.c
@@ -27,7 +27,6 @@
27#include "mesh_test_lib.h" 27#include "mesh_test_lib.h"
28#include "gnunet_mesh_service.h" 28#include "gnunet_mesh_service.h"
29#include "gnunet_statistics_service.h" 29#include "gnunet_statistics_service.h"
30#include <gauger.h>
31 30
32 31
33/** 32/**
@@ -59,31 +58,35 @@ struct MeshPeer
59 struct GNUNET_TESTBED_Operation *op; 58 struct GNUNET_TESTBED_Operation *op;
60 59
61 /** 60 /**
62 * Testbed peer handle.
63 */
64 struct GNUNET_TESTBED_Peer *testbed_peer;
65
66 /**
67 * Peer ID. 61 * Peer ID.
68 */ 62 */
69 struct GNUNET_PeerIdentity *id; 63 struct GNUNET_PeerIdentity id;
70 64
71 /** 65 /**
72 * Mesh handle for the root peer 66 * Mesh handle for the root peer
73 */ 67 */
74 static struct GNUNET_MESH_Handle *mesh; 68 struct GNUNET_MESH_Handle *mesh;
75 69
76 /** 70 /**
77 * Channel handle for the root peer 71 * Channel handle for the root peer
78 */ 72 */
79 static struct GNUNET_MESH_Channel *ch; 73 struct GNUNET_MESH_Channel *ch;
80 74
81 /** 75 /**
82 * Channel handle for the dest peer 76 * Channel handle for the dest peer
83 */ 77 */
84 static struct GNUNET_MESH_Channel *incoming_ch; 78 struct GNUNET_MESH_Channel *incoming_ch;
85}; 79};
86 80
81/**
82 * Testbed peer handles.
83 */
84struct GNUNET_TESTBED_Peer **testbed_handles;
85
86/**
87 * Testbed Operation (to get stats).
88 */
89struct GNUNET_TESTBED_Operation *stats_op;
87 90
88/** 91/**
89 * How many events have happened 92 * How many events have happened
@@ -186,9 +189,6 @@ show_end_data (void)
186 4 * TOTAL_PACKETS * 1.0 / (total_time.rel_value_us / 1000)); // 4bytes * ms 189 4 * TOTAL_PACKETS * 1.0 / (total_time.rel_value_us / 1000)); // 4bytes * ms
187 FPRINTF (stderr, "Test throughput: %f packets/s\n\n", 190 FPRINTF (stderr, "Test throughput: %f packets/s\n\n",
188 TOTAL_PACKETS * 1000.0 / (total_time.rel_value_us / 1000)); // packets * ms 191 TOTAL_PACKETS * 1000.0 / (total_time.rel_value_us / 1000)); // packets * ms
189 GAUGER ("MESH", test_name,
190 TOTAL_PACKETS * 1000.0 / (total_time.rel_value_us / 1000),
191 "packets/s");
192} 192}
193 193
194 194
@@ -233,8 +233,6 @@ disconnect_mesh_peers (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
233 { 233 {
234 GNUNET_SCHEDULER_cancel (shutdown_handle); 234 GNUNET_SCHEDULER_cancel (shutdown_handle);
235 } 235 }
236 if (NULL != stats_get)
237 GNUNET_STATISTICS_get_cancel (stats_get);
238 shutdown_handle = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL); 236 shutdown_handle = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL);
239} 237}
240 238
@@ -332,8 +330,7 @@ collect_stats (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
332 330
333 disconnect_task = GNUNET_SCHEDULER_NO_TASK; 331 disconnect_task = GNUNET_SCHEDULER_NO_TASK;
334 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Start collecting statistics...\n"); 332 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Start collecting statistics...\n");
335 GNUNET_MESH_channel_destroy (ch); 333 stats_op = GNUNET_TESTBED_get_statistics (TOTAL_PEERS, testbed_handles,
336 stats_op = GNUNET_TESTBED_get_statistics (TOTAL_PEERS, testbed_peers,
337 NULL, NULL, 334 NULL, NULL,
338 stats_iterator, stats_cont, NULL); 335 stats_iterator, stats_cont, NULL);
339} 336}
@@ -363,17 +360,19 @@ data_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
363{ 360{
364 struct GNUNET_MESH_TransmitHandle *th; 361 struct GNUNET_MESH_TransmitHandle *th;
365 struct GNUNET_MESH_Channel *channel; 362 struct GNUNET_MESH_Channel *channel;
363 long n = (long) cls;
366 364
367 if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0) 365 if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0)
368 return; 366 return;
369 367
370 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Data task\n"); 368 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Data task\n");
371 369
370 channel = peers[n].ch;
372 th = GNUNET_MESH_notify_transmit_ready (channel, GNUNET_NO, 371 th = GNUNET_MESH_notify_transmit_ready (channel, GNUNET_NO,
373 GNUNET_TIME_UNIT_FOREVER_REL, 372 GNUNET_TIME_UNIT_FOREVER_REL,
374 size_payload, &tmt_rdy, (void *) 1L); 373 size_payload, &tmt_rdy, (void *) 1L);
375 if (NULL == th) 374 if (NULL == th)
376 GNUNET_abort (0); 375 GNUNET_abort ();
377} 376}
378 377
379 378
@@ -442,7 +441,7 @@ data_callback (void *cls, struct GNUNET_MESH_Channel *channel,
442 void **channel_ctx, 441 void **channel_ctx,
443 const struct GNUNET_MessageHeader *message) 442 const struct GNUNET_MessageHeader *message)
444{ 443{
445 long client = (long) cls; 444// long n = (long) cls;
446 445
447 GNUNET_MESH_receive_done (channel); 446 GNUNET_MESH_receive_done (channel);
448 447
@@ -606,9 +605,9 @@ pi_cb (void *cls,
606 abort_test (__LINE__); 605 abort_test (__LINE__);
607 return; 606 return;
608 } 607 }
609 peers[n].id = pinfo->result.id; 608 peers[n].id = *(pinfo->result.id);
610 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " %u id: %s\n", 609 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " %u id: %s\n",
611 i, GNUNET_i2s (p_id[i])); 610 n, GNUNET_i2s (&peers[n].id));
612 p_ids++; 611 p_ids++;
613 if (p_ids < TOTAL_PEERS) 612 if (p_ids < TOTAL_PEERS)
614 return; 613 return;
@@ -640,6 +639,7 @@ tmain (void *cls,
640 test_ctx = ctx; 639 test_ctx = ctx;
641 GNUNET_assert (TOTAL_PEERS == num_peers); 640 GNUNET_assert (TOTAL_PEERS == num_peers);
642 peers_running = num_peers; 641 peers_running = num_peers;
642 testbed_handles = testbed_handles;
643 disconnect_task = GNUNET_SCHEDULER_add_delayed (SHORT_TIME, 643 disconnect_task = GNUNET_SCHEDULER_add_delayed (SHORT_TIME,
644 &disconnect_mesh_peers, 644 &disconnect_mesh_peers,
645 (void *) __LINE__); 645 (void *) __LINE__);
@@ -647,10 +647,9 @@ tmain (void *cls,
647 &shutdown_task, NULL); 647 &shutdown_task, NULL);
648 for (i = 0; i < TOTAL_PEERS; i++) 648 for (i = 0; i < TOTAL_PEERS; i++)
649 { 649 {
650 peers[i].testbed_peer = testbed_peers[i];
651 peers[i].mesh = meshes[i]; 650 peers[i].mesh = meshes[i];
652 peers[i].op = 651 peers[i].op =
653 GNUNET_TESTBED_peer_get_information (peers[i].testbed_peer, 652 GNUNET_TESTBED_peer_get_information (testbed_handles[i],
654 GNUNET_TESTBED_PIT_IDENTITY, 653 GNUNET_TESTBED_PIT_IDENTITY,
655 &pi_cb, (void *) i); 654 &pi_cb, (void *) i);
656 } 655 }