gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r26377 - gnunet/src/ats


From: gnunet
Subject: [GNUnet-SVN] r26377 - gnunet/src/ats
Date: Mon, 11 Mar 2013 14:23:56 +0100

Author: wachs
Date: 2013-03-11 14:23:56 +0100 (Mon, 11 Mar 2013)
New Revision: 26377

Modified:
   gnunet/src/ats/perf_ats_mlp.c
Log:
updating addresses


Modified: gnunet/src/ats/perf_ats_mlp.c
===================================================================
--- gnunet/src/ats/perf_ats_mlp.c       2013-03-11 13:21:43 UTC (rev 26376)
+++ gnunet/src/ats/perf_ats_mlp.c       2013-03-11 13:23:56 UTC (rev 26377)
@@ -78,6 +78,8 @@
 static int ret;
 static int opt_numeric;
 static int opt_dump;
+static int opt_update_percent;
+static int opt_update_quantity;
 
 static int N_peers_start;
 static int N_peers_end;
@@ -98,6 +100,8 @@
  */
 struct GNUNET_CONTAINER_MultiHashMap * addresses;
 
+struct GNUNET_ATS_Information ats[3];
+
 struct PerfPeer *peers;
 
 static void
@@ -153,9 +157,25 @@
 }
 
 
+static int
+update_address_it (void *cls, const struct GNUNET_HashCode *key, void * value)
+{
 
+       return GNUNET_OK;
+}
 
+static void
+update_addresses (void)
+{
+       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Updating addresses %u addresses 
per peer \n", opt_update_quantity);
 
+
+       GNUNET_CONTAINER_multihashmap_iterate (addresses, &update_address_it, 
NULL);
+
+
+}
+
+
 static void
 check (void *cls, char *const *args, const char *cfgfile,
        const struct GNUNET_CONFIGURATION_Handle *cfg)
@@ -187,14 +207,6 @@
   GNUNET_assert (N_peers_end >= N_peers_start);
   GNUNET_assert (N_address >= 0);
 
-  if ((0 == N_peers_start) && (0 == N_peers_end))
-  {
-               N_peers_start = PEERS_START;
-               N_peers_end = PEERS_END;
-  }
-  if (0 == N_address)
-               N_address = ADDRESSES;
-
   fprintf (stderr, "Solving problem for %u..%u peers with %u addresses\n",
                N_peers_start, N_peers_end, N_address);
 
@@ -260,8 +272,13 @@
                                                        (unsigned long long) 
mlp->ps.lp_dur.rel_value,
                                                        (unsigned long long) 
mlp->ps.mip_dur.rel_value,
                                                        mlp->ps.p_cols, 
mlp->ps.p_rows, mlp->ps.p_elements);
+                               if ((0 < opt_update_quantity) || (0 < 
opt_update_percent))
+                               {
+                                       GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 
"Updating problem with %u peers and %u addresses\n", cp + 1, ca);
+                                       update_addresses ();
+                                       GAS_mlp_solve_problem (mlp, addresses);
+                               }
                        }
-
        }
 
 
@@ -295,6 +312,8 @@
   };
 
   opt_dump = GNUNET_NO;
+  opt_update_quantity = 0;
+  opt_update_percent = 0;
 
   N_peers_start = 0;
   N_peers_end = 0;
@@ -302,28 +321,28 @@
   int c;
   for (c = 0; c < argc; c++)
   {
-               if ((0 == strcmp (argv[c], "-q")) && (c < argc))
+               if ((0 == strcmp (argv[c], "-z")) && (c < (argc - 1)))
                {
                                if (0 != atoi(argv[c+1]))
                                {
                                                N_peers_start = atoi(argv[c+1]);
                                }
                }
-               if ((0 == strcmp (argv[c], "-w")) && (c < argc))
+               if ((0 == strcmp (argv[c], "-x")) && (c < (argc - 1)))
                {
                                if (0 != atoi(argv[c+1]))
                                {
                                                N_peers_end = atoi(argv[c+1]);
                                }
                }
-               if ((0 == strcmp (argv[c], "-a")) && (c < argc))
+               if ((0 == strcmp (argv[c], "-c")) && (c < (argc - 1)))
                {
                                if (0 != atoi(argv[c+1]))
                                {
                                                N_address = atoi(argv[c+1]);
                                }
                }
-               if ((0 == strcmp (argv[c], "-n")))
+               if ((0 == strcmp (argv[c], "-v")))
                {
                                opt_numeric = GNUNET_YES;
                }
@@ -331,8 +350,48 @@
                {
                                opt_dump = GNUNET_YES;
                }
+               if ((0 == strcmp (argv[c], "-p")) && (c < (argc - 1)))
+               {
+                               if (0 != atoi(argv[c+1]))
+                               {
+                                       /* Update a fix "p"ercentage of 
addresses */
+                                               opt_update_percent = 
atoi(argv[c+1]);
+                                               if ((0 <= opt_update_percent) 
&& (100 <= opt_update_percent))
+                                               {
+                                                       fprintf (stderr, 
_("Percentage has to be: 0 <= p <= 100 "));
+                                                       exit (1);
+                                               }
+                               }
+               }
+               if ((0 == strcmp (argv[c], "-q")) && (c < (argc - 1)))
+               {
+                               if (0 != atoi(argv[c+1]))
+                               {
+                                       /* Update a fix "q"uantity of addresses 
*/
+                                               opt_update_quantity = 
atoi(argv[c+1]);
+                                               if (0 >= opt_update_quantity)
+                                               {
+                                                       fprintf (stderr, 
_("Quantity has to be:  p => 0 "));
+                                                       exit (1);
+                                               }
+                               }
+               }
   }
 
+  if ((0 == N_peers_start) && (0 == N_peers_end))
+  {
+               N_peers_start = PEERS_START;
+               N_peers_end = PEERS_END;
+  }
+  if (0 == N_address)
+               N_address = ADDRESSES;
+
+  if (opt_update_quantity >= N_address)
+  {
+               fprintf (stderr, _("Trying to Update more addresses than we 
have per peer!"));
+               exit (1);
+  }
+
   static const struct GNUNET_GETOPT_CommandLineOption options[] = {
     GNUNET_GETOPT_OPTION_END
   };




reply via email to

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