gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r32634 - gnunet/src/mesh


From: gnunet
Subject: [GNUnet-SVN] r32634 - gnunet/src/mesh
Date: Thu, 13 Mar 2014 16:01:40 +0100

Author: bartpolot
Date: 2014-03-13 16:01:40 +0100 (Thu, 13 Mar 2014)
New Revision: 32634

Modified:
   gnunet/src/mesh/Makefile.am
   gnunet/src/mesh/mesh_profiler.c
Log:
- fix compilation issues, add to Makefile

Modified: gnunet/src/mesh/Makefile.am
===================================================================
--- gnunet/src/mesh/Makefile.am 2014-03-13 15:01:39 UTC (rev 32633)
+++ gnunet/src/mesh/Makefile.am 2014-03-13 15:01:40 UTC (rev 32634)
@@ -84,6 +84,7 @@
 
 if HAVE_TESTING
  noinst_LIBRARIES = libgnunetmeshtest.a $(noinst_LIB_EXP)
+ noinst_PROGRAMS = gnunet-mesh-profiler
 endif
 
 libgnunetmeshtest_a_SOURCES = \
@@ -117,12 +118,18 @@
   $(top_builddir)/src/testbed/libgnunettestbed.la \
   $(top_builddir)/src/statistics/libgnunetstatistics.la
 
-
 dep_mesh_test_lib = \
   libgnunetmesh.la \
   libgnunetmeshtest.a \
   $(top_builddir)/src/statistics/libgnunetstatistics.la
 
+
+gnunet_mesh_profiler_SOURCES = \
+  mesh_profiler.c
+gnunet_mesh_profiler_LDADD = $(ld_mesh_test_lib)
+gnunet_mesh_profiler_DEPENDENCIES = $(dep_mesh_test_lib)
+
+
 test_mesh_single_SOURCES = \
   test_mesh_single.c
 test_mesh_single_LDADD = $(ld_mesh_test_lib)

Modified: gnunet/src/mesh/mesh_profiler.c
===================================================================
--- gnunet/src/mesh/mesh_profiler.c     2014-03-13 15:01:39 UTC (rev 32633)
+++ gnunet/src/mesh/mesh_profiler.c     2014-03-13 15:01:40 UTC (rev 32634)
@@ -27,7 +27,6 @@
 #include "mesh_test_lib.h"
 #include "gnunet_mesh_service.h"
 #include "gnunet_statistics_service.h"
-#include <gauger.h>
 
 
 /**
@@ -59,33 +58,37 @@
   struct GNUNET_TESTBED_Operation *op;
 
   /**
-   * Testbed peer handle.
-   */
-  struct GNUNET_TESTBED_Peer *testbed_peer;
-
-  /**
    * Peer ID.
    */
-  struct GNUNET_PeerIdentity *id;
+  struct GNUNET_PeerIdentity id;
 
   /**
    * Mesh handle for the root peer
    */
-  static struct GNUNET_MESH_Handle *mesh;
+  struct GNUNET_MESH_Handle *mesh;
 
   /**
    * Channel handle for the root peer
    */
-  static struct GNUNET_MESH_Channel *ch;
+  struct GNUNET_MESH_Channel *ch;
 
   /**
    * Channel handle for the dest peer
    */
-  static struct GNUNET_MESH_Channel *incoming_ch;
+  struct GNUNET_MESH_Channel *incoming_ch;
 };
 
+/**
+ * Testbed peer handles.
+ */
+struct GNUNET_TESTBED_Peer **testbed_handles;
 
 /**
+ * Testbed Operation (to get stats).
+ */
+struct GNUNET_TESTBED_Operation *stats_op;
+
+/**
  * How many events have happened
  */
 static int ok;
@@ -186,9 +189,6 @@
           4 * TOTAL_PACKETS * 1.0 / (total_time.rel_value_us / 1000)); // 
4bytes * ms
   FPRINTF (stderr, "Test throughput: %f packets/s\n\n",
           TOTAL_PACKETS * 1000.0 / (total_time.rel_value_us / 1000)); // 
packets * ms
-  GAUGER ("MESH", test_name,
-          TOTAL_PACKETS * 1000.0 / (total_time.rel_value_us / 1000),
-          "packets/s");
 }
 
 
@@ -233,8 +233,6 @@
   {
     GNUNET_SCHEDULER_cancel (shutdown_handle);
   }
-  if (NULL != stats_get)
-    GNUNET_STATISTICS_get_cancel (stats_get);
   shutdown_handle = GNUNET_SCHEDULER_add_now (&shutdown_task, NULL);
 }
 
@@ -332,8 +330,7 @@
 
   disconnect_task = GNUNET_SCHEDULER_NO_TASK;
   GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Start collecting statistics...\n");
-  GNUNET_MESH_channel_destroy (ch);
-  stats_op = GNUNET_TESTBED_get_statistics (TOTAL_PEERS, testbed_peers,
+  stats_op = GNUNET_TESTBED_get_statistics (TOTAL_PEERS, testbed_handles,
                                             NULL, NULL,
                                             stats_iterator, stats_cont, NULL);
 }
@@ -363,17 +360,19 @@
 {
   struct GNUNET_MESH_TransmitHandle *th;
   struct GNUNET_MESH_Channel *channel;
+  long n = (long) cls;
 
   if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0)
     return;
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Data task\n");
 
+  channel = peers[n].ch;
   th = GNUNET_MESH_notify_transmit_ready (channel, GNUNET_NO,
                                           GNUNET_TIME_UNIT_FOREVER_REL,
                                           size_payload, &tmt_rdy, (void *) 1L);
   if (NULL == th)
-    GNUNET_abort (0);
+    GNUNET_abort ();
 }
 
 
@@ -442,7 +441,7 @@
                void **channel_ctx,
                const struct GNUNET_MessageHeader *message)
 {
-  long client = (long) cls;
+//   long n = (long) cls;
 
   GNUNET_MESH_receive_done (channel);
 
@@ -606,9 +605,9 @@
     abort_test (__LINE__);
     return;
   }
-  peers[n].id = pinfo->result.id;
+  peers[n].id = *(pinfo->result.id);
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " %u  id: %s\n",
-              i, GNUNET_i2s (p_id[i]));
+              n, GNUNET_i2s (&peers[n].id));
   p_ids++;
   if (p_ids < TOTAL_PEERS)
     return;
@@ -640,6 +639,7 @@
   test_ctx = ctx;
   GNUNET_assert (TOTAL_PEERS == num_peers);
   peers_running = num_peers;
+  testbed_handles = testbed_handles;
   disconnect_task = GNUNET_SCHEDULER_add_delayed (SHORT_TIME,
                                                   &disconnect_mesh_peers,
                                                   (void *) __LINE__);
@@ -647,10 +647,9 @@
                                                   &shutdown_task, NULL);
   for (i = 0; i < TOTAL_PEERS; i++)
   {
-    peers[i].testbed_peer = testbed_peers[i];
     peers[i].mesh = meshes[i];
     peers[i].op =
-      GNUNET_TESTBED_peer_get_information (peers[i].testbed_peer,
+      GNUNET_TESTBED_peer_get_information (testbed_handles[i],
                                            GNUNET_TESTBED_PIT_IDENTITY,
                                            &pi_cb, (void *) i);
   }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]