gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r14817 - gnunet/src/transport
Date: Fri, 1 Apr 2011 13:40:08 +0200

Author: wachs
Date: 2011-04-01 13:40:08 +0200 (Fri, 01 Apr 2011)
New Revision: 14817

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


Modified: gnunet/src/transport/gnunet-service-transport.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport.c     2011-04-01 11:06:32 UTC 
(rev 14816)
+++ gnunet/src/transport/gnunet-service-transport.c     2011-04-01 11:40:08 UTC 
(rev 14817)
@@ -5603,8 +5603,8 @@
        return GNUNET_SYSERR;
 #else
        if (DEBUG_ATS) GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "glpk installed\n");
+#endif
 
-
        glp_prob *prob;
 
        int c;
@@ -5676,6 +5676,7 @@
                                mechanisms[c_mechs].col_index = c_mechs;
                                mechanisms[c_mechs].peer = &peers[c_peers];
                                mechanisms[c_mechs].next = NULL;
+                               mechanisms[c_mechs].plugin = r_next->plugin;
 
                                
GNUNET_CONTAINER_DLL_insert_tail(peers[c_peers].m_head, peers[c_peers].m_tail, 
&mechanisms[c_mechs]);
                                c_mechs++;
@@ -6058,22 +6059,27 @@
                default:
                        break;
        }
-
-       char * debug_solution = NULL;
-       char * old = NULL;
-       for (c=1; c<= (2*c_mechs) +3; c++ )
+#endif
+       int check;
+       double bw;
+       struct ATS_mechanism *t = NULL;
+       for (c=1; c<= (c_peers); c++ )
        {
-               old = debug_solution;
-               GNUNET_asprintf(&debug_solution, "%s %s = %g;", 
(debug_solution!=NULL) ? debug_solution : "", glp_get_col_name(prob,c), 
glp_get_col_prim(prob, c));
-               if (old!=NULL) GNUNET_free(old);
+               check = GNUNET_NO;
+               t = peers[c].m_head;
+               while (t!=NULL)
+               {
+                       bw = glp_get_col_prim(prob, t->col_index);
+                       GNUNET_assert (1);
+                       if (bw != 0)
+                       {
+                               GNUNET_assert (check != GNUNET_YES);
+                               check = GNUNET_YES;
+                               if (VERBOSE_ATS) GNUNET_log 
(GNUNET_ERROR_TYPE_ERROR, "[%i][%i] `%s' %s %s %f\n", c, t->col_index, 
GNUNET_h2s(&peers[c].peer.hashPubKey), t->plugin->short_name, 
glp_get_col_name(prob,t->col_index), bw);
+                       }
+                       t = t->next;
+               }
        }
-       old = debug_solution;
-       GNUNET_asprintf(&debug_solution, "%s z = %g; \n", debug_solution,  
glp_get_obj_val(prob));
-       if (old!=NULL) GNUNET_free(old);
-       GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "%s \n",debug_solution);
-       GNUNET_free(debug_solution);
-#endif
-
        res->c_mechs = c_mechs;
        res->c_peers = c_peers;
        res->solution = solution;
@@ -6091,7 +6097,7 @@
        GNUNET_free(peers);
 
        return c_mechs;
-#endif
+
 }
 
 void ats_calculate_bandwidth_distribution ()

Modified: gnunet/src/transport/test_transport_ats.c
===================================================================
--- gnunet/src/transport/test_transport_ats.c   2011-04-01 11:06:32 UTC (rev 
14816)
+++ gnunet/src/transport/test_transport_ats.c   2011-04-01 11:40:08 UTC (rev 
14817)
@@ -46,7 +46,6 @@
 
 static  GNUNET_SCHEDULER_TaskIdentifier shutdown_task;
 static  GNUNET_SCHEDULER_TaskIdentifier stats_task;
-
 struct GNUNET_TESTING_Daemon * master_deamon;
 
 struct GNUNET_STATISTICS_Handle * stats;
@@ -65,6 +64,11 @@
 static int peers;
 static struct TEST_result results[MEASUREMENTS];
 
+struct GNUNET_STATISTICS_GetHandle * s_solution;
+struct GNUNET_STATISTICS_GetHandle * s_time;
+struct GNUNET_STATISTICS_GetHandle * s_peers;
+struct GNUNET_STATISTICS_GetHandle * s_mechs;
+struct GNUNET_STATISTICS_GetHandle * s_duration;
 
 /**
  * Check whether peers successfully shut down.
@@ -105,6 +109,33 @@
                stats_task = GNUNET_SCHEDULER_NO_TASK;
        }
 
+       if (s_time != NULL)
+       {
+               GNUNET_STATISTICS_get_cancel(s_time);
+               s_time = NULL;
+       }
+       if (s_peers != NULL)
+       {
+               GNUNET_STATISTICS_get_cancel(s_peers);
+               s_peers = NULL;
+       }
+       if (s_mechs != NULL)
+       {
+               GNUNET_STATISTICS_get_cancel(s_mechs);
+               s_mechs = NULL;
+       }
+       if (s_solution != NULL)
+       {
+               GNUNET_STATISTICS_get_cancel(s_solution);
+               s_solution = NULL;
+       }
+       if (s_duration != NULL)
+       {
+               GNUNET_STATISTICS_get_cancel(s_duration);
+               s_duration = NULL;
+       }
+
+
     GNUNET_TESTING_daemons_stop (pg, TIMEOUT, &shutdown_callback, NULL);
 }
 
@@ -120,6 +151,8 @@
                output = temp;
        }
        GNUNET_log (GNUNET_ERROR_TYPE_ERROR,"%s\n",output);
+
+
        shutdown_peers();
 }
 
@@ -129,6 +162,30 @@
                           uint64_t value,
                           int is_persistent)
 {
+       if (0 == strcmp (name,"ATS solution"))
+       {
+               s_solution = NULL;
+       }
+
+       if (0 == strcmp (name,"ATS peers"))
+       {
+               s_peers = NULL;
+       }
+
+       if (0 == strcmp (name,"ATS mechanisms"))
+       {
+               s_mechs = NULL;
+       }
+
+       if (0 == strcmp (name,"ATS duration"))
+       {
+               s_duration = NULL;
+       }
+       if (0 == strcmp (name,"ATS timestamp"))
+       {
+               s_time = NULL;
+       }
+
     if ((measurement_started == GNUNET_NO) && (0 == strcmp (name, "ATS 
peers")) && (value == peers-1))
     {
                measurement_started = GNUNET_YES;
@@ -147,6 +204,11 @@
                                r_index++;
                                if (r_index >= MEASUREMENTS)
                                {
+                                       if (stats_task != 
GNUNET_SCHEDULER_NO_TASK)
+                                       {
+                                               
GNUNET_SCHEDULER_cancel(stats_task);
+                                               stats_task = 
GNUNET_SCHEDULER_NO_TASK;
+                                       }
                                        evaluate_measurements();
                                        return GNUNET_NO;
                                }
@@ -195,11 +257,11 @@
        if ( (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) != 0)
            return;
 
-       GNUNET_STATISTICS_get (stats, "transport", "ATS timestamp", TIMEOUT, 
NULL, &stats_cb, NULL);
-       GNUNET_STATISTICS_get (stats, "transport", "ATS solution", TIMEOUT, 
NULL, &stats_cb, NULL);
-       GNUNET_assert (NULL != GNUNET_STATISTICS_get (stats, "transport","ATS 
duration", TIMEOUT, NULL, &stats_cb, NULL));
-       GNUNET_STATISTICS_get (stats, "transport", "ATS peers", TIMEOUT, NULL, 
&stats_cb, NULL);
-       GNUNET_STATISTICS_get (stats, "transport", "ATS mechanisms", TIMEOUT, 
NULL, &stats_cb, NULL);
+       s_time = GNUNET_STATISTICS_get (stats, "transport", "ATS timestamp", 
TIMEOUT, NULL, &stats_cb, NULL);
+       s_solution = GNUNET_STATISTICS_get (stats, "transport", "ATS solution", 
TIMEOUT, NULL, &stats_cb, NULL);
+       s_duration = GNUNET_STATISTICS_get (stats, "transport","ATS duration", 
TIMEOUT, NULL, &stats_cb, NULL);
+       s_peers = GNUNET_STATISTICS_get (stats, "transport", "ATS peers", 
TIMEOUT, NULL, &stats_cb, NULL);
+       s_mechs = 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_MILLISECONDS, 250), &stats_get_task, NULL);
 }

Modified: gnunet/src/transport/transport.h
===================================================================
--- gnunet/src/transport/transport.h    2011-04-01 11:06:32 UTC (rev 14816)
+++ gnunet/src/transport/transport.h    2011-04-01 11:40:08 UTC (rev 14817)
@@ -31,8 +31,8 @@
 #include "gnunet_transport_service.h"
 
 /* Minimum time between to calculations*/
-#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_MIN_INTERVAL  
GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 1)
+#define ATS_EXEC_INTERVAL 
GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 2)
 #define ATS_MAX_EXEC_DURATION 
GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_MILLISECONDS, 100)
 #define ATS_MAX_ITERATIONS INT_MAX
 




reply via email to

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