gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r14806 - gnunet/src/transport


From: gnunet
Subject: [GNUnet-SVN] r14806 - gnunet/src/transport
Date: Thu, 31 Mar 2011 18:27:25 +0200

Author: wachs
Date: 2011-03-31 18:27:25 +0200 (Thu, 31 Mar 2011)
New Revision: 14806

Modified:
   gnunet/src/transport/gnunet-service-transport.c
   gnunet/src/transport/test_transport_ats.c
   gnunet/src/transport/transport.h
Log:
latest changes


Modified: gnunet/src/transport/gnunet-service-transport.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport.c     2011-03-31 15:56:03 UTC 
(rev 14805)
+++ gnunet/src/transport/gnunet-service-transport.c     2011-03-31 16:27:25 UTC 
(rev 14806)
@@ -6005,7 +6005,9 @@
        result = glp_intopt (prob, &opt_mlp);
        solution =  glp_mip_status (prob);
 
+#if VERBOSE_ATS
        if (VERBOSE_ATS) glp_write_lp(prob, NULL, "ats_mlp.lp");
+
        switch (result) {
        case GLP_ESTOP  :    /* search terminated by application */
                GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Search terminated by 
application ");
@@ -6038,7 +6040,7 @@
                        GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Problem has been 
solved\n");
        break;
        }
-#if VERBOSE_ATS
+
        switch (solution) {
                case GLP_UNDEF:
                        GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "MIP solution is 
undeļ¬ned\n");

Modified: gnunet/src/transport/test_transport_ats.c
===================================================================
--- gnunet/src/transport/test_transport_ats.c   2011-03-31 15:56:03 UTC (rev 
14805)
+++ gnunet/src/transport/test_transport_ats.c   2011-03-31 16:27:25 UTC (rev 
14806)
@@ -31,7 +31,7 @@
 #define MEASUREMENTS 5
 
 #define DELAY GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30)
-#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5)
+#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10)
 
 
 static int ok;
@@ -51,17 +51,21 @@
 
 struct GNUNET_STATISTICS_Handle * stats;
 
-struct ATS_result
+struct TEST_result
 {
        uint64_t timestamp;
-       int mechs;
-       int peers;
-       int solution;
+       uint64_t duration;
+       uint64_t mechs;
+       uint64_t peers;
+       uint64_t solution;
 };
 
-//static int index;
-static struct ATS_result results[MEASUREMENTS];
+static int r_index;
+//static int measurements;
+static int peers;
+static struct TEST_result results[MEASUREMENTS];
 
+
 /**
  * Check whether peers successfully shut down.
  */
@@ -95,47 +99,81 @@
     GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
 }
 
+static void evaluate_measurements()
+{
+       int c;
+       char * output = NULL;
+       char * temp;
+       for (c=0; c<MEASUREMENTS;c++)
+       {
+               GNUNET_asprintf(&temp, "%s ,%i,%llu,%llu,%llu,%llu,", 
(output==NULL) ? "" : output, c, results[c].peers, results[c].mechs, 
results[c].duration, results[c].solution);
+               GNUNET_free_non_null (output);
+               output = temp;
+       }
+       GNUNET_log (GNUNET_ERROR_TYPE_ERROR,"%s\n",output);
+       shutdown_peers();
+}
+
 int stats_cb (void *cls,
                           const char *subsystem,
                           const char *name,
                           uint64_t value,
                           int is_persistent)
 {
-    if ((measurement_started == GNUNET_NO) && (0 == strcmp (name, "ATS 
peers")) && (value == NUM_PEERS-1))
+    if ((measurement_started == GNUNET_NO) && (0 == strcmp (name, "ATS 
peers")) && (value == peers-1))
     {
                measurement_started = GNUNET_YES;
-               GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                                       "All %llu peers connected\n", value);
+               r_index = 0;
+               GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "All %llu peers 
connected\n", value);
     }
     if (measurement_started == GNUNET_YES)
     {
+               // GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "%s == %llu\n", name 
,value);
                if (0 == strcmp (name,"ATS timestamp"))
                {
-                       GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                                               "ATS timestamp: %s %llu 
\n",name, value);
+                       if (results[r_index].timestamp == 0)
+                               results[r_index].timestamp = value;
+                       if (results[r_index].timestamp != value)
+                       {
+                               r_index++;
+                               if (r_index >= MEASUREMENTS)
+                               {
+                                       evaluate_measurements();
+                                       return GNUNET_NO;
+                               }
+                               results[r_index].timestamp = value;
+                       }
+
+                       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                                               "[%i] ATS solution: %s %llu 
\n", r_index, name, value);
                }
+
                if (0 == strcmp (name,"ATS solution"))
                {
-                       GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                                               "ATS solution: %s %llu 
\n",name, value);
+                       results[r_index].solution = value;
+                       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                                               "[%i] ATS solution: %s %llu 
\n", r_index, name, value);
                }
+
                if (0 == strcmp (name,"ATS peers"))
                {
-                       GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                                               "ATS peers: %s %llu \n",name, 
value);
+                       results[r_index].peers = value;
+                       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                                               "[%i] ATS peers: %s %llu \n", 
r_index, name, value);
                }
+
                if (0 == strcmp (name,"ATS mechanisms"))
                {
-                       GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                                               "ATS mechanisms: %s %llu 
\n",name, value);
+                       results[r_index].mechs = value;
+                       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "[%i] ATS 
mechanisms: %s %llu \n", r_index, name, value);
                }
+
                if (0 == strcmp (name,"ATS duration"))
                {
-                       GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                                               "ATS duration: %s %llu 
\n",name, value);
+                       results[r_index].duration = value;
+                       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "[%i] ATS 
duration: %s %llu \n", r_index, name, value);
                }
     }
-
     return GNUNET_OK;
 }
 
@@ -154,7 +192,7 @@
        GNUNET_STATISTICS_get (stats, "transport", "ATS peers", TIMEOUT, NULL, 
&stats_cb, NULL);
        GNUNET_STATISTICS_get (stats, "transport", "ATS mechanisms", TIMEOUT, 
NULL, &stats_cb, NULL);
 
-       stats_task = GNUNET_SCHEDULER_add_delayed(GNUNET_TIME_relative_multiply 
(GNUNET_TIME_UNIT_SECONDS, 1), &stats_get_task, NULL);
+       stats_task = GNUNET_SCHEDULER_add_delayed(GNUNET_TIME_relative_multiply 
(GNUNET_TIME_UNIT_MILLISECONDS, 250), &stats_get_task, NULL);
 }
 
 void
@@ -262,7 +300,7 @@
 #if VERBOSE
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting %i peers.\n", NUM_PEERS);
 #endif
-  peers_left = NUM_PEERS;
+  peers_left = peers;
   pg = GNUNET_TESTING_daemons_start (cfg,
                                      peers_left, /* Total number of peers */
                                      peers_left, /* Number of outstanding 
connections */
@@ -298,13 +336,22 @@
 {
   int ret;
 
-  GNUNET_log_setup ("test-testing-group",
+  GNUNET_log_setup ("test-transport-ats",
 #if VERBOSE
                     "DEBUG",
 #else
                     "WARNING",
 #endif
                     NULL);
+
+  peers = NUM_PEERS;
+  if (argc >= 2)
+  {
+         peers = atoi(argv[1]);
+         peers++;
+         if(peers <1)
+                 peers = NUM_PEERS;
+  }
   ret = check ();
   /**
    * Still need to remove the base testing directory here,

Modified: gnunet/src/transport/transport.h
===================================================================
--- gnunet/src/transport/transport.h    2011-03-31 15:56:03 UTC (rev 14805)
+++ gnunet/src/transport/transport.h    2011-03-31 16:27:25 UTC (rev 14806)
@@ -31,9 +31,9 @@
 #include "gnunet_transport_service.h"
 
 /* Minimum time between to calculations*/
-#define ATS_MIN_INTERVAL  
GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 1)
-#define ATS_EXEC_INTERVAL 
GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 5)
-#define ATS_MAX_EXEC_DURATION 
GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 500)
+#define ATS_MIN_INTERVAL  
GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MILLISECONDS, 200)
+#define ATS_EXEC_INTERVAL 
GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MILLISECONDS, 250)
+#define ATS_MAX_EXEC_DURATION 
GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MILLISECONDS, 100)
 #define ATS_MAX_ITERATIONS INT_MAX
 
 struct ATS_info




reply via email to

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