gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r32739 - gnunet/src/mesh
Date: Fri, 21 Mar 2014 19:44:48 +0100

Author: bartpolot
Date: 2014-03-21 19:44:48 +0100 (Fri, 21 Mar 2014)
New Revision: 32739

Modified:
   gnunet/src/mesh/gnunet-mesh-profiler.c
   gnunet/src/mesh/profiler.conf
   gnunet/src/mesh/run_profiler.sh
Log:
-move round time to cli, fix config file

Modified: gnunet/src/mesh/gnunet-mesh-profiler.c
===================================================================
--- gnunet/src/mesh/gnunet-mesh-profiler.c      2014-03-21 18:44:46 UTC (rev 
32738)
+++ gnunet/src/mesh/gnunet-mesh-profiler.c      2014-03-21 18:44:48 UTC (rev 
32739)
@@ -34,11 +34,6 @@
 
 
 /**
- * Duration of each round.
- */
-#define ROUND_TIME GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5)
-
-/**
  * Paximum ping period in milliseconds. Real period = rand (0, PING_PERIOD)
  */
 #define PING_PERIOD 1000
@@ -61,7 +56,7 @@
 /**
  * Ratio of peers active. First round always is 1.0.
  */
-static float rounds[] = {0.8, 0.6, 0.4, 0.2, 0.0};
+static float rounds[] = {0.8, 0.7, 0.6, 0.5, 0.4, 0.3, 0.2, 0.0};
 
 /**
  * Message type for pings.
@@ -157,6 +152,11 @@
 };
 
 /**
+ * Duration of each round.
+ */
+static struct GNUNET_TIME_Relative round_time;
+
+/**
  * GNUNET_PeerIdentity -> MeshPeer
  */
 static struct GNUNET_CONTAINER_MultiPeerMap *ids;
@@ -525,7 +525,7 @@
   adjust_running_peers (rounds[current_round] * peers_total);
   current_round++;
 
-  GNUNET_SCHEDULER_add_delayed (ROUND_TIME, &next_rnd, NULL);
+  GNUNET_SCHEDULER_add_delayed (round_time, &next_rnd, NULL);
 }
 
 
@@ -844,11 +844,11 @@
   if (GNUNET_SCHEDULER_NO_TASK != disconnect_task)
     GNUNET_SCHEDULER_cancel (disconnect_task);
   disconnect_task =
-    GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply(ROUND_TIME,
+    GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply(round_time,
                                                                 number_rounds 
+ 1),
                                   &disconnect_mesh_peers,
                                   (void *) __LINE__);
-  GNUNET_SCHEDULER_add_delayed (ROUND_TIME, &next_rnd, NULL);
+  GNUNET_SCHEDULER_add_delayed (round_time, &next_rnd, NULL);
 }
 
 
@@ -947,12 +947,20 @@
 
   config_file = ".profiler.conf";
 
-  if (3 > argc)
+  if (4 > argc)
   {
-    fprintf (stderr, "usage: %s PEERS PINGS\n", argv[0]);
+    fprintf (stderr, "usage: %s ROUND_TIME PEERS PINGS\n", argv[0]);
+    fprintf (stderr, "example: %s 30s 16 1\n", argv[0]);
     return 1;
   }
-  peers_total = atoll (argv[1]);
+
+  if (GNUNET_OK != GNUNET_STRINGS_fancy_time_to_relative (argv[1], 
&round_time))
+  {
+    fprintf (stderr, "%s is not a valid time\n", argv[1]);
+    return 1;
+  }
+
+  peers_total = atoll (argv[2]);
   if (2 > peers_total)
   {
     fprintf (stderr, "%s peers is not valid (> 2)\n", argv[1]);
@@ -960,7 +968,7 @@
   }
   peers = GNUNET_malloc (sizeof (struct MeshPeer) * peers_total);
 
-  peers_pinging = atoll (argv[2]);
+  peers_pinging = atoll (argv[3]);
 
   if (peers_total < 2 * peers_pinging)
   {

Modified: gnunet/src/mesh/profiler.conf
===================================================================
--- gnunet/src/mesh/profiler.conf       2014-03-21 18:44:46 UTC (rev 32738)
+++ gnunet/src/mesh/profiler.conf       2014-03-21 18:44:48 UTC (rev 32739)
@@ -1,8 +1,8 @@
 @INLINE@ test_mesh.conf
 [testbed]
 OVERLAY_TOPOLOGY = RANDOM
-OVERLAY_RANDOM_LINKS = 200
+OVERLAY_RANDOM_LINKS = %LINKS%
 
 [transport]
 #MANIPULATE_DELAY_IN = 50 ms
-MANIPULATE_DELAY_OUT = 100 ms
\ No newline at end of file
+MANIPULATE_DELAY_OUT = 100 ms

Modified: gnunet/src/mesh/run_profiler.sh
===================================================================
--- gnunet/src/mesh/run_profiler.sh     2014-03-21 18:44:46 UTC (rev 32738)
+++ gnunet/src/mesh/run_profiler.sh     2014-03-21 18:44:48 UTC (rev 32739)
@@ -1,11 +1,14 @@
 #!/bin/sh
 
-if [ "$#" -lt "2" ]; then
-    echo "usage: $0 PEERS PINGING_PEERS";
+if [ "$#" -lt "3" ]; then
+    echo "usage: $0 ROUND_TIME PEERS PINGING_PEERS";
+    echo "example: $0 30s 16 1";
     exit 1;
 fi
 
-PEERS=$1
+ROUNDTIME=$1
+PEERS=$2
+PINGS=$3
 
 if [ $PEERS -eq 1 ]; then
     echo "cannot run 1 peer";
@@ -18,4 +21,4 @@
     
 sed -e "s/%LINKS%/$LINKS/g" profiler.conf > .profiler.conf
 
-./gnunet-mesh-profiler $PEERS $2 |& tee log
+./gnunet-mesh-profiler $ROUNDTIME $PEERS $PINGS |& tee log




reply via email to

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