aboutsummaryrefslogtreecommitdiff
path: root/src/mesh
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2012-01-25 01:54:17 +0000
committerBart Polot <bart@net.in.tum.de>2012-01-25 01:54:17 +0000
commitb7dc738f4f7b98f01f9e9add2fb869e4caa0dd48 (patch)
treef5b3422b6505321e97e5c5dd3f9ca669da67d30d /src/mesh
parentabe16a76d40facc3995ec17e5e25b9a22f9f771b (diff)
downloadgnunet-b7dc738f4f7b98f01f9e9add2fb869e4caa0dd48.tar.gz
gnunet-b7dc738f4f7b98f01f9e9add2fb869e4caa0dd48.zip
- Added summary info for speed test
Diffstat (limited to 'src/mesh')
-rw-r--r--src/mesh/test_mesh_small.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/mesh/test_mesh_small.c b/src/mesh/test_mesh_small.c
index bac494cd6..3fafe0569 100644
--- a/src/mesh/test_mesh_small.c
+++ b/src/mesh/test_mesh_small.c
@@ -22,11 +22,12 @@
22 * 22 *
23 * @brief Test for the mesh service: retransmission of traffic. 23 * @brief Test for the mesh service: retransmission of traffic.
24 */ 24 */
25#include <stdio.h>
25#include "platform.h" 26#include "platform.h"
26#include "gnunet_testing_lib.h" 27#include "gnunet_testing_lib.h"
27#include "gnunet_mesh_service.h" 28#include "gnunet_mesh_service.h"
28 29
29#define VERBOSE GNUNET_YES 30#define VERBOSE GNUNET_NO
30#define REMOVE_DIR GNUNET_YES 31#define REMOVE_DIR GNUNET_YES
31 32
32struct MeshPeer 33struct MeshPeer
@@ -172,6 +173,8 @@ static struct GNUNET_TIME_Absolute start_time;
172 173
173static struct GNUNET_TIME_Absolute end_time; 174static struct GNUNET_TIME_Absolute end_time;
174 175
176static struct GNUNET_TIME_Relative total_time;
177
175 178
176static uint16_t *mesh_peers; 179static uint16_t *mesh_peers;
177 180
@@ -359,9 +362,12 @@ data_callback (void *cls, struct GNUNET_MESH_Tunnel *tunnel, void **tunnel_ctx,
359 if (data_ack < 1000) 362 if (data_ack < 1000)
360 return GNUNET_OK; 363 return GNUNET_OK;
361 end_time = GNUNET_TIME_absolute_get(); 364 end_time = GNUNET_TIME_absolute_get();
362 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 365 total_time = GNUNET_TIME_absolute_get_difference(start_time, end_time);
363 "***************** test time %u ms\n", 366 FPRINTF (stderr, "\nTest time %lu ms\n", total_time.rel_value);
364 GNUNET_TIME_absolute_get_difference(start_time, end_time).rel_value); 367 FPRINTF (stderr, "Test bandwidth: %f kb/s\n",
368 4000.0 / total_time.rel_value);
369 FPRINTF (stderr, "Test throughput: %f packets/s\n",
370 1000000.0 / total_time.rel_value);
365 } 371 }
366 GNUNET_MESH_tunnel_destroy (tunnel); 372 GNUNET_MESH_tunnel_destroy (tunnel);
367 if (GNUNET_SCHEDULER_NO_TASK != disconnect_task) 373 if (GNUNET_SCHEDULER_NO_TASK != disconnect_task)
@@ -1008,7 +1014,9 @@ main (int argc, char *argv[])
1008 test = SPEED_ACK; 1014 test = SPEED_ACK;
1009 ok_goal = 2003; 1015 ok_goal = 2003;
1010 argv2 [3] = NULL; // remove -L DEBUG 1016 argv2 [3] = NULL; // remove -L DEBUG
1017#if VERBOSE
1011 argc2 -= 2; 1018 argc2 -= 2;
1019#endif
1012 } 1020 }
1013 else if (strstr (argv[0], "test_mesh_small_speed") != NULL) 1021 else if (strstr (argv[0], "test_mesh_small_speed") != NULL)
1014 { 1022 {