gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r30491 - in gnunet/src: ats include


From: gnunet
Subject: [GNUnet-SVN] r30491 - in gnunet/src: ats include
Date: Thu, 31 Oct 2013 15:10:38 +0100

Author: wachs
Date: 2013-10-31 15:10:37 +0100 (Thu, 31 Oct 2013)
New Revision: 30491

Modified:
   gnunet/src/ats/libgnunet_plugin_ats_mlp.c
   gnunet/src/ats/libgnunet_plugin_ats_proportional.c
   gnunet/src/ats/libgnunet_plugin_ats_ril.c
   gnunet/src/ats/perf_ats_solver.c
   gnunet/src/include/gnunet_ats_plugin.h
Log:
adding additional INFO


Modified: gnunet/src/ats/libgnunet_plugin_ats_mlp.c
===================================================================
--- gnunet/src/ats/libgnunet_plugin_ats_mlp.c   2013-10-31 12:26:35 UTC (rev 
30490)
+++ gnunet/src/ats/libgnunet_plugin_ats_mlp.c   2013-10-31 14:10:37 UTC (rev 
30491)
@@ -1078,10 +1078,12 @@
 }
 
 static void notify (struct GAS_MLP_Handle *mlp,
-    enum GAS_Solver_Operation op, enum GAS_Solver_Status stat)
+    enum GAS_Solver_Operation op,
+    enum GAS_Solver_Status stat,
+    enum GAS_Solver_Additional_Information add)
 {
   if (NULL != mlp->env->info_cb)
-    mlp->env->info_cb (mlp->env->info_cb_cls, op, stat);
+    mlp->env->info_cb (mlp->env->info_cb_cls, op, stat, add);
 }
 /**
  * Solves the MLP problem
@@ -1103,36 +1105,36 @@
     mlp->bulk_request ++;
     return GNUNET_NO;
   }
-  notify (mlp, GAS_OP_SOLVE_START, GAS_STAT_SUCCESS);
+  notify (mlp, GAS_OP_SOLVE_START, GAS_STAT_SUCCESS, GAS_INFO_NONE);
 
   if (0 == GNUNET_CONTAINER_multipeermap_size (mlp->requested_peers))
   {
-    notify (mlp, GAS_OP_SOLVE_STOP, GAS_STAT_SUCCESS);
+    notify (mlp, GAS_OP_SOLVE_STOP, GAS_STAT_SUCCESS, GAS_INFO_NONE);
     return GNUNET_OK; /* No pending requests */
   }
   if (0 == GNUNET_CONTAINER_multipeermap_size (mlp->addresses))
   {
-    notify (mlp, GAS_OP_SOLVE_STOP, GAS_STAT_SUCCESS);
+    notify (mlp, GAS_OP_SOLVE_STOP, GAS_STAT_SUCCESS, GAS_INFO_NONE);
     return GNUNET_OK; /* No addresses available */
   }
 
   if ((GNUNET_NO == mlp->mlp_prob_changed) && (GNUNET_NO == 
mlp->mlp_prob_updated))
   {
     LOG (GNUNET_ERROR_TYPE_DEBUG, "No changes to problem\n");
-    notify (mlp, GAS_OP_SOLVE_STOP, GAS_STAT_SUCCESS);
+    notify (mlp, GAS_OP_SOLVE_STOP, GAS_STAT_SUCCESS, GAS_INFO_NONE);
     return GNUNET_OK;
   }
   if (GNUNET_YES == mlp->mlp_prob_changed)
   {
       LOG (GNUNET_ERROR_TYPE_DEBUG, "Problem size changed, rebuilding\n");
-      notify (mlp, GAS_OP_SOLVE_SETUP_START, GAS_STAT_SUCCESS);
+      notify (mlp, GAS_OP_SOLVE_SETUP_START, GAS_STAT_SUCCESS, 
GAS_INFO_MLP_FULL);
       mlp_delete_problem (mlp);
       if (GNUNET_SYSERR == mlp_create_problem (mlp))
       {
-        notify (mlp, GAS_OP_SOLVE_SETUP_STOP, GAS_STAT_FAIL);
+        notify (mlp, GAS_OP_SOLVE_SETUP_STOP, GAS_STAT_FAIL, 
GAS_INFO_MLP_FULL);
         return GNUNET_SYSERR;
       }
-      notify (mlp, GAS_OP_SOLVE_SETUP_STOP, GAS_STAT_SUCCESS);
+      notify (mlp, GAS_OP_SOLVE_SETUP_STOP, GAS_STAT_SUCCESS, 
GAS_INFO_MLP_FULL);
       mlp->control_param_lp.presolve = GLP_YES;
       mlp->control_param_mlp.presolve = GNUNET_NO; /* No presolver, we have LP 
solution */
   }
@@ -1142,21 +1144,29 @@
   }
 
   /* Run LP solver */
+
+  notify (mlp, GAS_OP_SOLVE_LP_START, GAS_STAT_SUCCESS,
+      (GNUNET_YES == mlp->mlp_prob_changed) ? GAS_INFO_MLP_FULL : 
GAS_INFO_MLP_UPDATED);
   LOG (GNUNET_ERROR_TYPE_DEBUG, "Running LP solver %s\n",
       (GLP_YES == mlp->control_param_lp.presolve)? "with presolver": "without 
presolver");
-  notify (mlp, GAS_OP_SOLVE_LP_START, GAS_STAT_SUCCESS);
   res_lp = mlp_solve_lp_problem (mlp);
-  notify (mlp, GAS_OP_SOLVE_LP_STOP, (GNUNET_OK == res_lp) ? GAS_STAT_SUCCESS 
: GAS_STAT_FAIL);
+  notify (mlp, GAS_OP_SOLVE_LP_STOP,
+      (GNUNET_OK == res_lp) ? GAS_STAT_SUCCESS : GAS_STAT_FAIL,
+      (GNUNET_YES == mlp->mlp_prob_changed) ? GAS_INFO_MLP_FULL : 
GAS_INFO_MLP_UPDATED);
 
 
   /* Run MLP solver */
   LOG (GNUNET_ERROR_TYPE_DEBUG, "Running MLP solver \n");
-  notify (mlp, GAS_OP_SOLVE_MLP_START, GAS_STAT_SUCCESS);
+  notify (mlp, GAS_OP_SOLVE_MLP_START, GAS_STAT_SUCCESS,
+      (GNUNET_YES == mlp->mlp_prob_changed) ? GAS_INFO_MLP_FULL : 
GAS_INFO_MLP_UPDATED);
   res_mip = mlp_solve_mlp_problem (mlp);
-  notify (mlp, GAS_OP_SOLVE_MLP_STOP, (GNUNET_OK == res_mip) ? 
GAS_STAT_SUCCESS : GAS_STAT_FAIL);
+  notify (mlp, GAS_OP_SOLVE_MLP_STOP,
+      (GNUNET_OK == res_lp) ? GAS_STAT_SUCCESS : GAS_STAT_FAIL,
+      (GNUNET_YES == mlp->mlp_prob_changed) ? GAS_INFO_MLP_FULL : 
GAS_INFO_MLP_UPDATED);
+  notify (mlp, GAS_OP_SOLVE_STOP,
+      (GNUNET_OK == res_mip) ? GAS_STAT_SUCCESS : GAS_STAT_FAIL,
+      (GNUNET_YES == mlp->mlp_prob_changed) ? GAS_INFO_MLP_FULL : 
GAS_INFO_MLP_UPDATED);
 
-  notify (mlp, GAS_OP_SOLVE_STOP, (GNUNET_OK == res_mip) ? GAS_STAT_SUCCESS : 
GAS_STAT_FAIL);
-
   /* Save stats */
   mlp->ps.lp_res = res_lp;
   mlp->ps.mip_res = res_mip;

Modified: gnunet/src/ats/libgnunet_plugin_ats_proportional.c
===================================================================
--- gnunet/src/ats/libgnunet_plugin_ats_proportional.c  2013-10-31 12:26:35 UTC 
(rev 30490)
+++ gnunet/src/ats/libgnunet_plugin_ats_proportional.c  2013-10-31 14:10:37 UTC 
(rev 30491)
@@ -549,12 +549,6 @@
   unsigned long long assigned_quota_out = 0;
   struct AddressWrapper *cur;
 
-  if (GNUNET_YES == s->bulk_lock)
-  {
-    s->bulk_requests++;
-    return;
-  }
-
   LOG(GNUNET_ERROR_TYPE_DEBUG,
       "Recalculate quota for network type `%s' for %u addresses (in/out): 
%llu/%llu \n",
       net->desc, net->active_addresses, net->total_quota_in,
@@ -812,16 +806,31 @@
     struct Network *n,
     struct ATS_Address *address_except)
 {
+  if (GNUNET_YES == s->bulk_lock)
+  {
+    s->bulk_requests++;
+    return;
+  }
+
   if (NULL != n)
   {
+    if (NULL != s->env->info_cb)
+      s->env->info_cb (s->env->info_cb_cls, GAS_OP_SOLVE_START, 
GAS_STAT_SUCCESS, GAS_INFO_PROP_SINGLE);
     distribute_bandwidth (s, n, address_except);
+    if (NULL != s->env->info_cb)
+      s->env->info_cb (s->env->info_cb_cls, GAS_OP_SOLVE_STOP, 
GAS_STAT_SUCCESS, GAS_INFO_PROP_SINGLE);
   }
   else
   {
     int i;
+    if (NULL != s->env->info_cb)
+      s->env->info_cb (s->env->info_cb_cls, GAS_OP_SOLVE_START, 
GAS_STAT_SUCCESS, GAS_INFO_PROP_ALL);
     for (i = 0; i < s->network_count; i++)
       distribute_bandwidth (s, &s->network_entries[i], NULL );
+    if (NULL != s->env->info_cb)
+      s->env->info_cb (s->env->info_cb_cls, GAS_OP_SOLVE_STOP, 
GAS_STAT_SUCCESS, GAS_INFO_PROP_ALL);
   }
+
 }
 
 /**
@@ -1112,7 +1121,7 @@
 
   fba_ctx.best->active = GNUNET_YES;
   addresse_increment (s, net_cur, GNUNET_NO, GNUNET_YES);
-  distribute_bandwidth_in_network (s, net_cur, fba_ctx.best );
+  distribute_bandwidth_in_network (s, net_cur, fba_ctx.best);
   return fba_ctx.best;
 }
 

Modified: gnunet/src/ats/libgnunet_plugin_ats_ril.c
===================================================================
--- gnunet/src/ats/libgnunet_plugin_ats_ril.c   2013-10-31 12:26:35 UTC (rev 
30490)
+++ gnunet/src/ats/libgnunet_plugin_ats_ril.c   2013-10-31 14:10:37 UTC (rev 
30491)
@@ -519,7 +519,7 @@
     enum GAS_Solver_Operation op, enum GAS_Solver_Status stat)
 {
   if (NULL != solver->plugin_envi->info_cb)
-    solver->plugin_envi->info_cb (solver->plugin_envi->info_cb_cls, op, stat);
+    solver->plugin_envi->info_cb (solver->plugin_envi->info_cb_cls, op, stat, 
GAS_INFO_NONE);
 }
 
 /**

Modified: gnunet/src/ats/perf_ats_solver.c
===================================================================
--- gnunet/src/ats/perf_ats_solver.c    2013-10-31 12:26:35 UTC (rev 30490)
+++ gnunet/src/ats/perf_ats_solver.c    2013-10-31 14:10:37 UTC (rev 30491)
@@ -40,22 +40,22 @@
 #define GNUPLOT_PROP_TEMPLATE "#!/usr/bin/gnuplot \n" \
 "set datafile separator ';' \n" \
 "set title \"Execution time Proportional solver  \" \n" \
-"set xlabel \"Time in us\" \n" \
-"set ylabel \"Bytes/s\" \n" \
+"set xlabel \"Number of peers\" \n" \
+"set ylabel \"Execution time in us\" \n" \
 "set grid \n"
 
 #define GNUPLOT_MLP_TEMPLATE "#!/usr/bin/gnuplot \n" \
 "set datafile separator ';' \n" \
 "set title \"Execution time MLP solver \" \n" \
-"set xlabel \"Time in us\" \n" \
-"set ylabel \"Bytes/s\" \n" \
+"set xlabel \"Number of peers\" \n" \
+"set ylabel \"Execution time in us\" \n" \
 "set grid \n"
 
 #define GNUPLOT_RIL_TEMPLATE "#!/usr/bin/gnuplot \n" \
 "set datafile separator ';' \n" \
 "set title \"Execution time RIL solver \" \n" \
-"set xlabel \"Time in us\" \n" \
-"set ylabel \"Bytes/s\" \n" \
+"set xlabel \"Number of peers\" \n" \
+"set ylabel \"Execution time in us\" \n" \
 "set grid \n"
 
 /**
@@ -375,8 +375,10 @@
 }
 
 static void
-solver_info_cb (void *cls, enum GAS_Solver_Operation op,
-    enum GAS_Solver_Status stat)
+solver_info_cb (void *cls,
+    enum GAS_Solver_Operation op,
+    enum GAS_Solver_Status stat,
+    enum GAS_Solver_Additional_Information add)
 {
 
   struct Result *tmp;
@@ -509,22 +511,14 @@
 }
 
 static void
-write_gnuplot_script ()
+write_gnuplot_script (char * data_fn)
 {
-  struct Result *cur;
-  struct Result *next;
   struct GNUNET_DISK_FileHandle *f;
   char * gfn;
   char *data;
   char *template;
-  int c_s;
-  int index;
-  int plot_d_total;
-  int plot_d_setup;
-  int plot_d_lp;
-  int plot_d_mlp;
 
-  GNUNET_asprintf (&gfn, "perf_%s_%u_%u_%u", ph.ats_string, ph.N_peers_start, 
ph.N_peers_end, ph.N_address);
+  GNUNET_asprintf (&gfn, "perf_%s_%u_%u_%u.gnuplot", ph.ats_string, 
ph.N_peers_start, ph.N_peers_end, ph.N_address);
   f = GNUNET_DISK_file_open (gfn,
       GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_CREATE,
       GNUNET_DISK_PERM_USER_EXEC | GNUNET_DISK_PERM_USER_READ | 
GNUNET_DISK_PERM_USER_WRITE);
@@ -536,7 +530,6 @@
   }
 
   /* Write header */
-
   switch (ph.ats_mode) {
     case MODE_PROPORTIONAL:
       template = GNUPLOT_PROP_TEMPLATE;
@@ -550,56 +543,38 @@
     default:
       break;
   }
-
   if (GNUNET_SYSERR == GNUNET_DISK_file_write(f, template, strlen(template)))
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot write data to plot file 
`%s'\n", gfn);
-#if 0
-  cur = ph.head->d_total;
-  if (cur->d_total != GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us)
-    plot_d_total = GNUNET_YES;
 
-  if (cur->d_total != GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us)
-    plot_d_total = GNUNET_YES;
-  if (cur->d_setup != GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us)
-    plot_d_setup = GNUNET_YES;
-  if (cur->d_lp != GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us)
-    plot_d_lp = GNUNET_YES;
-  if (cur->d_mlp != GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us)
-    plot_d_mlp = GNUNET_YES;
-
-
-    GNUNET_asprintf (&data, "plot "\
-        "'%s' using 2:%u with lines title 'BW out master %u - Slave %u ', 
\\\n" \
-        "'%s' using 2:%u with lines title 'BW in master %u - Slave %u '"\
-        "%s\n",
-        "\n pause -1",
-        fn, index + LOG_ITEM_ATS_BW_OUT, lp->peer->no, 
lp->peer->partners[c_s].dest->no,
-        fn, index + LOG_ITEM_ATS_BW_IN, lp->peer->no, 
lp->peer->partners[c_s].dest->no);
-
-    GNUNET_free (data);
-#endif
-    if (GNUNET_SYSERR == GNUNET_DISK_file_write(f, data, strlen(data)))
-        GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot write data to plot file 
`%s'\n", gfn);
-
-
-#if 0
-  index = LOG_ITEMS_TIME + LOG_ITEMS_PER_PEER;
-  for (c_s = 0; c_s < lp->peer->num_partners; c_s++)
+  if (MODE_PROPORTIONAL == ph.ats_mode)
   {
-    GNUNET_asprintf (&data, "%s"\
-        "'%s' using 2:%u with lines title 'BW out master %u - Slave %u ', 
\\\n" \
-        "'%s' using 2:%u with lines title 'BW in master %u - Slave %u '"\
-        "%s\n",
-        (0 == c_s) ? "plot " :"",
-        fn, index + LOG_ITEM_ATS_BW_OUT, lp->peer->no, 
lp->peer->partners[c_s].dest->no,
-        fn, index + LOG_ITEM_ATS_BW_IN, lp->peer->no, 
lp->peer->partners[c_s].dest->no,
-        (c_s < lp->peer->num_partners -1) ? ", \\" : "\n pause -1");
-
-    GNUNET_free (data);
-    index += LOG_ITEMS_PER_PEER;
+    GNUNET_asprintf (&data, "plot '%s' using 1:%u with lines title 'Total time 
to solve'\n" \
+                           "pause -1",
+                           data_fn, 3);
   }
-#endif
+  if (MODE_MLP == ph.ats_mode)
+  {
+    GNUNET_asprintf (&data, "plot '%s' using 1:%u with lines title 'Total time 
to solve',\\\n" \
+                            "'%s' using 1:%u with lines title 'Time to 
setup',\\\n"
+                            "'%s' using 1:%u with lines title 'Time to solve 
LP',\\\n"
+                            "'%s' using 1:%u with lines title 'Total time to 
solve MLP'\n" \
+                            "pause -1",
+                           data_fn, 3,
+                           data_fn, 4,
+                           data_fn, 5,
+                           data_fn, 6);
+  }
+  if (MODE_RIL == ph.ats_mode)
+  {
+    GNUNET_asprintf (&data, "plot '%s' using 1:%u with lines title 'Total time 
to solve'\n" \
+                           "pause -1",
+                           data_fn, 3);
+  }
 
+  if (GNUNET_SYSERR == GNUNET_DISK_file_write(f, data, strlen(data)))
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot write data to plot file 
`%s'\n", gfn);
+  GNUNET_free (data);
+
   if (GNUNET_SYSERR == GNUNET_DISK_file_close(f))
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot close gnuplot file `%s'\n", 
gfn);
   else
@@ -624,21 +599,19 @@
 
   if (ph.create_plot)
   {
-    GNUNET_asprintf (&data_fn, "perf_%s_%u_%u_%u_data", ph.ats_string, 
ph.N_peers_start, ph.N_peers_end, ph.N_address);
+    GNUNET_asprintf (&data_fn, "perf_%s_%u_%u_%u.data", ph.ats_string, 
ph.N_peers_start, ph.N_peers_end, ph.N_address);
     f = GNUNET_DISK_file_open (data_fn,
         GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_CREATE,
         GNUNET_DISK_PERM_USER_EXEC | GNUNET_DISK_PERM_USER_READ | 
GNUNET_DISK_PERM_USER_WRITE);
     if (NULL == f)
     {
       GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot open gnuplot file `%s'\n", 
data_fn);
-      GNUNET_free (data_fn);
       return;
     }
     data = "#peers;addresses;time total in us;#time setup in us;#time lp in 
us;#time mlp in us;\n";
     if (GNUNET_SYSERR == GNUNET_DISK_file_write(f, data, strlen(data)))
             GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot write data to log 
file `%s'\n", data_fn);
-
-    write_gnuplot_script ();
+    write_gnuplot_script (data_fn);
   }
 
   next = ph.head;
@@ -697,9 +670,7 @@
       GNUNET_free (str_d_lp);
       GNUNET_free (str_d_mlp);
       GNUNET_free (data);
-
     }
-
     GNUNET_CONTAINER_DLL_remove (ph.head, ph.tail, cur);
     GNUNET_free (cur);
   }
@@ -707,11 +678,8 @@
   if (GNUNET_YES == ph.create_plot)
   {
     if (GNUNET_SYSERR == GNUNET_DISK_file_close(f))
-    {
       GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot close log file `%s'\n", 
data_fn);
-      GNUNET_free (data_fn);
-    }
-
+    GNUNET_free (data_fn);
   }
 }
 

Modified: gnunet/src/include/gnunet_ats_plugin.h
===================================================================
--- gnunet/src/include/gnunet_ats_plugin.h      2013-10-31 12:26:35 UTC (rev 
30490)
+++ gnunet/src/include/gnunet_ats_plugin.h      2013-10-31 14:10:37 UTC (rev 
30491)
@@ -321,6 +321,19 @@
 };
 
 /**
+ * Status of the operation
+ */
+enum GAS_Solver_Additional_Information
+{
+  GAS_INFO_NONE,
+  GAS_INFO_MLP_FULL,
+  GAS_INFO_MLP_UPDATED,
+  GAS_INFO_PROP_ALL,
+  GAS_INFO_PROP_SINGLE
+};
+
+
+/**
  * Callback to call with additional information
  * Used for measurement
  *
@@ -333,7 +346,9 @@
  */
 typedef void
 (*GAS_solver_information_callback) (void *cls,
-    enum GAS_Solver_Operation op, enum GAS_Solver_Status stat);
+    enum GAS_Solver_Operation op,
+    enum GAS_Solver_Status stat,
+    enum GAS_Solver_Additional_Information);
 
 
 /**




reply via email to

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