[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r23014 - gnunet/src/mesh
From: |
gnunet |
Subject: |
[GNUnet-SVN] r23014 - gnunet/src/mesh |
Date: |
Tue, 31 Jul 2012 14:38:23 +0200 |
Author: bartpolot
Date: 2012-07-31 14:38:23 +0200 (Tue, 31 Jul 2012)
New Revision: 23014
Modified:
gnunet/src/mesh/test_mesh_local_traffic.c
Log:
- improved testcase, feedback, debug messages
Modified: gnunet/src/mesh/test_mesh_local_traffic.c
===================================================================
--- gnunet/src/mesh/test_mesh_local_traffic.c 2012-07-31 12:15:21 UTC (rev
23013)
+++ gnunet/src/mesh/test_mesh_local_traffic.c 2012-07-31 12:38:23 UTC (rev
23014)
@@ -32,9 +32,19 @@
#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5)
-#define TARGET 100
+#define TARGET 1000
+GNUNET_NETWORK_STRUCT_BEGIN
+struct test_traffic_message
+{
+ struct GNUNET_MessageHeader header;
+ uint32_t data GNUNET_PACKED;
+};
+
+GNUNET_NETWORK_STRUCT_END
+
+
static struct GNUNET_MESH_Handle *mesh_peer_1;
static struct GNUNET_MESH_Handle *mesh_peer_2;
@@ -135,7 +145,11 @@
const struct GNUNET_MessageHeader *message,
const struct GNUNET_ATS_Information *atsi)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Data callback\n");
+ struct test_traffic_message *msg;
+
+ msg = (struct test_traffic_message *) message;
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Got data packet # %u [%u]\n",
+ ntohl (msg->data), got + 1);
got++;
if (TARGET == got)
{
@@ -217,10 +231,13 @@
tmt_rdy (void *cls, size_t size, void *buf)
{
struct GNUNET_MessageHeader *m = buf;
- size_t msize = sizeof (struct GNUNET_MessageHeader);
+ struct test_traffic_message *msg = buf;
+ size_t msize = sizeof (struct test_traffic_message);
if (0 == size || NULL == buf)
return 0;
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending data packet # %u\n",
+ sent);
GNUNET_assert (size >= msize);
sent++;
if (TARGET > sent)
@@ -229,6 +246,7 @@
&peer_id, msize, &tmt_rdy, NULL);
m->size = htons (msize);
m->type = htons (1);
+ msg->data = htonl (sent - 1);
return msize;
}
@@ -247,7 +265,7 @@
peer_id = *peer;
start_time = GNUNET_TIME_absolute_get();
GNUNET_MESH_notify_transmit_ready (t, GNUNET_NO,
GNUNET_TIME_UNIT_FOREVER_REL,
- peer, sizeof (struct
GNUNET_MessageHeader),
+ peer, sizeof (struct
test_traffic_message),
&tmt_rdy, NULL);
}
@@ -349,7 +367,7 @@
total_time = GNUNET_TIME_absolute_get_difference(start_time, end_time);
FPRINTF (stderr, "\nTest time %llu ms\n",
(unsigned long long) total_time.rel_value);
- FPRINTF (stderr, "Test bandwidth: %f kb/s\n",
+ FPRINTF (stderr, "Test payload bandwidth: %f kb/s\n",
4 * 1000.0 / total_time.rel_value); // 4bytes * ms
FPRINTF (stderr, "Test throughput: %f packets/s\n\n",
TARGET * 1000.0 / total_time.rel_value); // 1000 packets * ms
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r23014 - gnunet/src/mesh,
gnunet <=