[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r32639 - gnunet/src/mesh
From: |
gnunet |
Subject: |
[GNUnet-SVN] r32639 - gnunet/src/mesh |
Date: |
Thu, 13 Mar 2014 16:01:44 +0100 |
Author: bartpolot
Date: 2014-03-13 16:01:44 +0100 (Thu, 13 Mar 2014)
New Revision: 32639
Modified:
gnunet/src/mesh/mesh_profiler.c
Log:
- fix warnings, remove explicit keepalive count
Modified: gnunet/src/mesh/mesh_profiler.c
===================================================================
--- gnunet/src/mesh/mesh_profiler.c 2014-03-13 15:01:43 UTC (rev 32638)
+++ gnunet/src/mesh/mesh_profiler.c 2014-03-13 15:01:44 UTC (rev 32639)
@@ -90,17 +90,18 @@
struct MeshPeer *dest;
struct MeshPeer *incoming;
GNUNET_SCHEDULER_TaskIdentifier ping_task;
+ struct GNUNET_TIME_Absolute timestamp;
};
/**
* Testbed peer handles.
*/
-struct GNUNET_TESTBED_Peer **testbed_handles;
+static struct GNUNET_TESTBED_Peer **testbed_handles;
/**
* Testbed Operation (to get stats).
*/
-struct GNUNET_TESTBED_Operation *stats_op;
+static struct GNUNET_TESTBED_Operation *stats_op;
/**
* How many events have happened
@@ -110,7 +111,7 @@
/**
* Number of events expected to conclude the test successfully.
*/
-int ok_goal;
+static int ok_goal;
/**
* Size of each test packet
@@ -125,7 +126,7 @@
/**
* Peer ids counter.
*/
-unsigned int p_ids;
+static unsigned int p_ids;
/**
* Is the setup initialized?
@@ -140,7 +141,7 @@
/**
* Test context (to shut down).
*/
-struct GNUNET_MESH_TEST_Context *test_ctx;
+static struct GNUNET_MESH_TEST_Context *test_ctx;
/**
* Task called to shutdown test.
@@ -164,10 +165,9 @@
static struct GNUNET_TIME_Absolute start_time;
/**
- *
+ * Flag to notify callbacks not to generate any new traffic anymore.
*/
-static unsigned int ka_sent;
-static unsigned int ka_received;
+static int test_finished;
/**
* Calculate a random delay.
@@ -267,7 +267,7 @@
/**
- * Abort test: schedule disconnect and shutdown immediately
+ * Finish test normally: schedule disconnect and shutdown
*
* @param line Line in the code the abort is requested from (__LINE__).
*/
@@ -282,7 +282,6 @@
}
}
-
/**
* Stats callback. Finish the stats testbed operation and when all stats have
* been iterated, shutdown the test.
@@ -322,24 +321,12 @@
const char *subsystem, const char *name,
uint64_t value, int is_persistent)
{
- static const char *s_sent = "# keepalives sent";
- static const char *s_recv = "# keepalives received";
uint32_t i;
i = GNUNET_TESTBED_get_index (peer);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " %u - %s [%s]: %llu\n",
i, subsystem, name, value);
- if (0 == strncmp (s_sent, name, strlen (s_sent)) && 0 == i)
- ka_sent = value;
- if (0 == strncmp(s_recv, name, strlen (s_recv)) && 4 == i)
- {
- ka_received = value;
- GNUNET_log (GNUNET_ERROR_TYPE_INFO, " sent: %u, received: %u\n",
- ka_sent, ka_received);
- if (ka_sent < 2 || ka_sent > ka_received + 1)
- ok--;
- }
return GNUNET_OK;
}
@@ -366,6 +353,25 @@
/**
+ * @brief Finish profiler normally.
+ *
+ * @param cls Closure (unused).
+ * @param tc Task context.
+ */
+static void
+finish_profiler (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+{
+ if ((GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason) != 0)
+ return;
+
+ test_finished = GNUNET_YES;
+ show_end_data();
+ GNUNET_SCHEDULER_add_now (&collect_stats, NULL);
+}
+
+
+
+/**
* Transmit ready callback.
*
* @param cls Closure (peer).
@@ -475,8 +481,8 @@
GNUNET_SCHEDULER_add_now (&data_task, peer);
}
}
-
- peers->ping_task = GNUNET_SCHEDULER_add_delayed (delay_ms_rnd (60 * 1000),
+ peer->timestamp = GNUNET_TIME_absolute_get ();
+ peer->ping_task = GNUNET_SCHEDULER_add_delayed (delay_ms_rnd (60 * 1000),
&ping, peer);
return size_payload;
@@ -699,6 +705,8 @@
GNUNET_assert (TOTAL_PEERS == num_peers);
peers_running = num_peers;
testbed_handles = testbed_handles;
+ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES,
+ &finish_profiler, NULL);
disconnect_task = GNUNET_SCHEDULER_add_delayed (SHORT_TIME,
&disconnect_mesh_peers,
(void *) __LINE__);
@@ -730,6 +738,7 @@
config_file = "test_mesh.conf";
p_ids = 0;
+ test_finished = GNUNET_NO;
ports[0] = 1;
ports[1] = 0;
GNUNET_MESH_TEST_run ("mesh_profiler", config_file, TOTAL_PEERS,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r32639 - gnunet/src/mesh,
gnunet <=