gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r16093 - gnunet/src/transport
Date: Mon, 18 Jul 2011 17:45:50 +0200

Author: wachs
Date: 2011-07-18 17:45:50 +0200 (Mon, 18 Jul 2011)
New Revision: 16093

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


Modified: gnunet/src/transport/gnunet-service-transport.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport.c     2011-07-18 14:39:12 UTC 
(rev 16092)
+++ gnunet/src/transport/gnunet-service-transport.c     2011-07-18 15:45:50 UTC 
(rev 16093)
@@ -997,7 +997,7 @@
       fal->quality[c].values[1] = fal->quality[c].values[2];
       fal->quality[c].values[2] = value;
       set = GNUNET_YES;
-#if HAVE_GLPK
+#if HAVE_LIBGLPK
       ats_modify_problem_state (ats, ATS_QUALITY_UPDATED);
 #endif
     }
@@ -1010,7 +1010,7 @@
       {
         fal->ressources[c].c = value;
         set = GNUNET_YES;
-#if HAVE_GLPK
+#if HAVE_LIBGLPK
         ats_modify_problem_state (ats, ATS_COST_UPDATED);
 #endif
       }
@@ -2510,7 +2510,7 @@
     }
   GNUNET_free_non_null(pos->ressources);
   GNUNET_free_non_null(pos->quality);
-#if HAVE_GLPK
+#if HAVE_LIBGLPK
   ats_modify_problem_state (ats, ATS_MODIFIED);
 #endif
   if (GNUNET_YES != pos->connected)
@@ -2680,9 +2680,9 @@
   /* notify ats about connecting peer */
   if ((ats != NULL) && (shutdown_in_progress == GNUNET_NO))
     {
-#if HAVE_GLPK
+#if HAVE_LIBGLPK
       ats_modify_problem_state(ats, ATS_MODIFIED);
-      ats_calculate_bandwidth_distribution (ats, stats);
+      ats_calculate_bandwidth_distribution (ats);
 #endif
     }
   cpos = clients;
@@ -2728,9 +2728,9 @@
   /* notify ats about connecting peer */
   if ((ats != NULL) && (shutdown_in_progress == GNUNET_NO))
   {
-#if HAVE_GLPK
+#if HAVE_LIBGLPK
     ats_modify_problem_state(ats, ATS_MODIFIED);
-    ats_calculate_bandwidth_distribution (ats, stats);
+    ats_calculate_bandwidth_distribution (ats);
 #endif
   }
 
@@ -4896,7 +4896,7 @@
       n->received_pong = GNUNET_NO;
       notify_clients_disconnect (&n->id);
     }
-#if HAVE_GLPK
+#if HAVE_LIBGLPK
   ats_modify_problem_state(ats, ATS_MODIFIED);
 #endif
   /* clean up all plugins, cancel connections and pending transmissions */
@@ -5428,7 +5428,7 @@
     if ((ntohs(message->type) == GNUNET_MESSAGE_TYPE_TRANSPORT_ATS) &&
        (ntohs(message->size) == (sizeof (struct GNUNET_MessageHeader) + sizeof 
(uint32_t))))
       {
-#if HAVE_GLPK
+#if HAVE_LIBGLPK
        uint32_t value =  ntohl(*((uint32_t *) &message[1]));
        //GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 
"GNUNET_MESSAGE_TYPE_TRANSPORT_ATS: %i \n", value);
        /* Force ressource and quality update */
@@ -6322,7 +6322,7 @@
     GNUNET_SCHEDULER_cancel(ats_task);
     ats_task = GNUNET_SCHEDULER_NO_TASK;
   }
-#if HAVE_GLPK
+#if HAVE_LIBGLPK
   if (ats != NULL)
     ats_shutdown (ats);
 #endif
@@ -6516,8 +6516,8 @@
 #if DEBUG_ATS
   GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Running scheduled calculation\n");
 #endif
-#if HAVE_GLPK
-  ats_calculate_bandwidth_distribution (ats, stats);
+#if HAVE_LIBGLPK
+  ats_calculate_bandwidth_distribution (ats);
 #endif
   last_ats_execution = GNUNET_TIME_absolute_get();
 
@@ -6671,7 +6671,7 @@
   int co;
   char * section;
   unsigned long long  value;
-#if HAVE_GLPK
+#if HAVE_LIBGLPK
   double D = 1.0;
   double U = 1.0;
   double R = 1.0;
@@ -6720,7 +6720,7 @@
     }
     GNUNET_free (section);
   }
-#if HAVE_GLPK
+#if HAVE_LIBGLPK
   ats = ats_init (D, U, R, v_b_min, v_n_min,
                   ATS_MAX_ITERATIONS, ATS_MAX_EXEC_DURATION,
                   create_ats_information,
@@ -6764,8 +6764,9 @@
                                                     "transport",
                                                     "ATS_MIN_INTERVAL", 
                                                     &ats_minimum_interval));
-#if HAVE_GLPK
+#if HAVE_LIBGLPK
   ats_set_logging_options (ats,
+                          stats,
                           minimum_addresses,
                           minimum_peers,
                           overwrite_dump,

Modified: gnunet/src/transport/gnunet-service-transport_ats.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport_ats.c 2011-07-18 14:39:12 UTC 
(rev 16092)
+++ gnunet/src/transport/gnunet-service-transport_ats.c 2011-07-18 15:45:50 UTC 
(rev 16093)
@@ -457,9 +457,12 @@
   _dummy2();
 }
 
+
+
 static void _dummy2 ()
 {
   ats_modify_problem_state (NULL, 0);
+  qm[1].atis_index = 0;
    _dummy();
    int t = ATS_COST_UPDATED + ATS_MODIFIED + ATS_NEW;
    t = 0;
@@ -1303,8 +1306,7 @@
 
 
 void
-ats_calculate_bandwidth_distribution (struct ATS_Handle * ats,
-    struct GNUNET_STATISTICS_Handle *stats)
+ats_calculate_bandwidth_distribution (struct ATS_Handle * ats)
 {
     struct GNUNET_TIME_Absolute start;
     struct GNUNET_TIME_Relative creation;
@@ -1401,50 +1403,50 @@
           (ats->internal.simplex_rerun_required == GNUNET_NO) ? "NO" : "YES",
           (ats->internal.solution == 5) ? "OPTIMAL" : "INVALID");
       ats->successful_executions ++;
-      GNUNET_STATISTICS_set (stats, "# ATS successful executions",
+      GNUNET_STATISTICS_set (ats->stats, "# ATS successful executions",
           ats->successful_executions,
           GNUNET_NO);
 
       if ((ats->internal.recreate_problem == GNUNET_YES) || (ats->prob==NULL))
-          GNUNET_STATISTICS_set (stats, "ATS state",ATS_NEW, GNUNET_NO);
+          GNUNET_STATISTICS_set (ats->stats, "ATS state",ATS_NEW, GNUNET_NO);
       else if ((ats->internal.modified_resources == GNUNET_YES) &&
               (ats->internal.modified_quality == GNUNET_NO))
-        GNUNET_STATISTICS_set (stats, "ATS state", ATS_COST_UPDATED, 
GNUNET_NO);
+        GNUNET_STATISTICS_set (ats->stats, "ATS state", ATS_COST_UPDATED, 
GNUNET_NO);
       else if ((ats->internal.modified_resources == GNUNET_NO) &&
               (ats->internal.modified_quality == GNUNET_YES) &&
               (ats->internal.simplex_rerun_required == GNUNET_NO))
-        GNUNET_STATISTICS_set (stats, "ATS state", ATS_QUALITY_UPDATED, 
GNUNET_NO);
+        GNUNET_STATISTICS_set (ats->stats, "ATS state", ATS_QUALITY_UPDATED, 
GNUNET_NO);
       else if ((ats->internal.modified_resources == GNUNET_YES) &&
               (ats->internal.modified_quality == GNUNET_YES) &&
               (ats->internal.simplex_rerun_required == GNUNET_NO))
-        GNUNET_STATISTICS_set (stats, "ATS state", ATS_QUALITY_COST_UPDATED, 
GNUNET_NO);
+        GNUNET_STATISTICS_set (ats->stats, "ATS state", 
ATS_QUALITY_COST_UPDATED, GNUNET_NO);
       else if (ats->internal.simplex_rerun_required == GNUNET_NO)
-        GNUNET_STATISTICS_set (stats, "ATS state", ATS_UNMODIFIED, GNUNET_NO);
+        GNUNET_STATISTICS_set (ats->stats, "ATS state", ATS_UNMODIFIED, 
GNUNET_NO);
     }
     else
     {
       if (ats->internal.c_peers != 0)
       {
         ats->invalid_executions ++;
-        GNUNET_STATISTICS_set (stats, "# ATS invalid executions",
+        GNUNET_STATISTICS_set (ats->stats, "# ATS invalid executions",
             ats->invalid_executions, GNUNET_NO);
       }
       else
       {
-        GNUNET_STATISTICS_set (stats, "# ATS successful executions",
+        GNUNET_STATISTICS_set (ats->stats, "# ATS successful executions",
             ats->successful_executions, GNUNET_NO);
       }
     }
 
-    GNUNET_STATISTICS_set (stats,
+    GNUNET_STATISTICS_set (ats->stats,
         "ATS duration", solving.rel_value + creation.rel_value, GNUNET_NO);
-    GNUNET_STATISTICS_set (stats,
+    GNUNET_STATISTICS_set (ats->stats,
         "ATS mechanisms", ats->internal.c_mechs, GNUNET_NO);
-    GNUNET_STATISTICS_set (stats,
+    GNUNET_STATISTICS_set (ats->stats,
         "ATS peers", ats->internal.c_peers, GNUNET_NO);
-    GNUNET_STATISTICS_set (stats,
+    GNUNET_STATISTICS_set (ats->stats,
         "ATS solution", ats->internal.solution, GNUNET_NO);
-    GNUNET_STATISTICS_set (stats,
+    GNUNET_STATISTICS_set (ats->stats,
         "ATS timestamp", start.abs_value, GNUNET_NO);
 
     if ((ats->save_mlp == GNUNET_YES) &&
@@ -1666,6 +1668,7 @@
 }
 
 void ats_set_logging_options (struct ATS_Handle * ats,
+                              struct GNUNET_STATISTICS_Handle * stats,
                               int minimum_addresses,
                               int minimum_peers,
                               int overwrite_dump,
@@ -1674,7 +1677,7 @@
 {
   if (ats == NULL)
     return;
-
+  ats->stats = stats;
   ats->dump_min_addr = minimum_addresses;
   ats->dump_min_peers = minimum_peers;
   ats->dump_overwrite = overwrite_dump;

Modified: gnunet/src/transport/gnunet-service-transport_ats.h
===================================================================
--- gnunet/src/transport/gnunet-service-transport_ats.h 2011-07-18 14:39:12 UTC 
(rev 16092)
+++ gnunet/src/transport/gnunet-service-transport_ats.h 2011-07-18 15:45:50 UTC 
(rev 16093)
@@ -215,7 +215,13 @@
 
     GNUNET_TRANSPORT_ATS_ResultCallback result_cb;
 
+
     /**
+     * Statistics handle
+     */
+    struct GNUNET_STATISTICS_Handle *stats;
+
+    /**
      * Maximum execution time per calculation
      */
     struct GNUNET_TIME_Relative max_exec_duration;
@@ -474,8 +480,7 @@
     enum ATS_problem_state s);
 
 void
-ats_calculate_bandwidth_distribution (struct ATS_Handle * ats,
-    struct GNUNET_STATISTICS_Handle *stats);
+ats_calculate_bandwidth_distribution (struct ATS_Handle * ats);
 
 void
 ats_solve_problem (struct ATS_Handle * ats,
@@ -499,6 +504,7 @@
 
 void
 ats_set_logging_options (struct ATS_Handle * ats,
+                        struct GNUNET_STATISTICS_Handle *stats,
                         int minimum_addresses,
                         int minimum_peers,
                         int overwrite_dump,




reply via email to

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