gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r33093 - gnunet/src/ats
Date: Wed, 16 Apr 2014 11:35:10 +0200

Author: wachs
Date: 2014-04-16 11:35:10 +0200 (Wed, 16 Apr 2014)
New Revision: 33093

Modified:
   gnunet/src/ats/gnunet-ats-solver-eval.c
   gnunet/src/ats/gnunet-ats-solver-eval.h
Log:
file logging

Modified: gnunet/src/ats/gnunet-ats-solver-eval.c
===================================================================
--- gnunet/src/ats/gnunet-ats-solver-eval.c     2014-04-16 09:32:06 UTC (rev 
33092)
+++ gnunet/src/ats/gnunet-ats-solver-eval.c     2014-04-16 09:35:10 UTC (rev 
33093)
@@ -53,7 +53,7 @@
 /**
  * cmd option -p: enable plots
  */
-static int opt_plot;
+static int opt_save;
 
 /**
  * cmd option -v: verbose logs
@@ -262,7 +262,106 @@
   l->logging_task = GNUNET_SCHEDULER_NO_TASK;
 }
 
+static struct LoggingFileHandle *
+find_logging_file_handle (struct LoggingFileHandle *lf_head,
+    struct LoggingFileHandle *lf_tail,
+    int peer_id, int address_id)
+{
+  struct LoggingFileHandle *res;
+
+  for (res = lf_head; NULL != res; res = res->next)
+    if ((res->pid == peer_id) && (res->pid == address_id))
+      return res;
+  return NULL;
+
+}
+
 void
+GNUNET_ATS_solver_logging_write_to_disk (struct LoggingHandle *l)
+{
+  struct LoggingTimeStep *lts;
+  struct LoggingPeer *log_p;
+  struct LoggingAddress *log_a;
+  struct LoggingFileHandle *lf_head;
+  struct LoggingFileHandle *lf_tail;
+  struct LoggingFileHandle *cur;
+  struct LoggingFileHandle *next;
+  char * filename;
+  char * datastring;
+  int c;
+
+
+  lf_head = NULL;
+  lf_tail = NULL;
+
+  for (lts = l->head; NULL != lts; lts = lts->next)
+  {
+
+    fprintf (stderr, "Log step %llu %llu: \n",
+        (long long unsigned int) lts->timestamp.abs_value_us,
+        (long long unsigned int) lts->delta.rel_value_us);
+
+    for (log_p = lts->head; NULL != log_p; log_p = log_p->next)
+    {
+      for (log_a = log_p->addr_head; NULL != log_a; log_a = log_a->next)
+      {
+
+        cur = find_logging_file_handle (lf_head, lf_tail, log_p->id,
+            log_a->aid);
+        if (NULL == cur)
+        {
+          cur = GNUNET_new (struct LoggingFileHandle);
+          cur->aid = log_a->aid;
+          cur->pid = log_p->id;
+
+          fprintf (stderr, "Add logging for %i %i: \n",
+              cur->pid, cur->aid);
+
+          GNUNET_asprintf (&filename, "%s_%s_%u_%u_%llu.log", e->log_prefix, 
opt_solver,
+              cur->aid, cur->pid, l->head->timestamp.abs_value_us);
+          cur->f_hd = GNUNET_DISK_file_open (filename,
+              GNUNET_DISK_OPEN_READWRITE |
+              GNUNET_DISK_OPEN_CREATE |
+              GNUNET_DISK_OPEN_TRUNCATE,
+              GNUNET_DISK_PERM_USER_READ |
+              GNUNET_DISK_PERM_USER_WRITE |
+              GNUNET_DISK_PERM_GROUP_READ |
+              GNUNET_DISK_PERM_OTHER_READ);
+          if (NULL == cur->f_hd)
+          {
+            fprintf (stderr, "Cannot open `%s' to write log data!\n", 
filename);
+            GNUNET_free (filename);
+            goto cleanup;
+          }
+          GNUNET_free (filename);
+          GNUNET_CONTAINER_DLL_insert (lf_head, lf_tail, cur);
+        }
+
+        GNUNET_asprintf(&datastring,"%i;%u;%u\n",
+            log_a->active,
+            ntohl (log_a->assigned_bw_in.value__),
+            ntohl (log_a->assigned_bw_out.value__));
+        GNUNET_DISK_file_write (cur->f_hd, datastring, strlen(datastring));
+        GNUNET_free (datastring);
+
+      }
+    }
+  }
+
+cleanup:
+  next = lf_head;
+  for (cur = next; NULL != cur; cur = next)
+  {
+    next = cur->next;
+    GNUNET_CONTAINER_DLL_remove (lf_head, lf_tail, cur);
+    if (NULL != cur->f_hd)
+      GNUNET_DISK_file_close (cur->f_hd);
+    GNUNET_free (cur);
+  }
+
+}
+
+void
 GNUNET_ATS_solver_logging_eval (struct LoggingHandle *l)
 {
   struct LoggingTimeStep *lts;
@@ -278,7 +377,7 @@
 
     for (log_p = lts->head; NULL != log_p; log_p = log_p->next)
     {
-      fprintf (stderr,"\tLogging peer id %u\n", log_p->id);
+      fprintf (stderr,"\tLogging peer pid %u\n", log_p->id);
       for (c = 0; c < GNUNET_ATS_PreferenceCount; c++)
       {
         fprintf(stderr,"\t %s = %.2f %.2f [abs/rel]\n",
@@ -288,7 +387,7 @@
 
       for (log_a = log_p->addr_head; NULL != log_a; log_a = log_a->next)
       {
-        fprintf (stderr, "\tPeer id %u address %u: %u %u %u\n",
+        fprintf (stderr, "\tPeer pid %u address %u: %u %u %u\n",
             log_p->id, log_a->aid, log_a->active,
             ntohl(log_a->assigned_bw_in.value__),
             ntohl(log_a->assigned_bw_out.value__));
@@ -911,6 +1010,7 @@
   }
 
   GNUNET_free_non_null (e->name);
+  GNUNET_free_non_null (e->log_prefix);
   GNUNET_free_non_null (e->cfg_file);
   GNUNET_free (e);
 }
@@ -925,7 +1025,7 @@
 {
   char *op_name;
 
-  /* peer id */
+  /* peer pid */
   GNUNET_asprintf(&op_name, "op-%u-peer-id", op_counter);
   if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg,
       sec_name, op_name, &o->peer_id))
@@ -937,7 +1037,7 @@
   }
   GNUNET_free (op_name);
 
-  /* address id */
+  /* address pid */
   GNUNET_asprintf(&op_name, "op-%u-address-id", op_counter);
   if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg,
       sec_name, op_name, &o->address_id))
@@ -1013,7 +1113,7 @@
 {
   char *op_name;
 
-  /* peer id */
+  /* peer pid */
   GNUNET_asprintf(&op_name, "op-%u-peer-id", op_counter);
   if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg,
       sec_name, op_name, &o->peer_id))
@@ -1025,7 +1125,7 @@
   }
   GNUNET_free (op_name);
 
-  /* address id */
+  /* address pid */
   GNUNET_asprintf(&op_name, "op-%u-address-id", op_counter);
   if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg,
       sec_name, op_name, &o->address_id))
@@ -1115,7 +1215,7 @@
   char *type;
   char *pref;
 
-  /* peer id */
+  /* peer pid */
   GNUNET_asprintf(&op_name, "op-%u-peer-id", op_counter);
   if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg,
       sec_name, op_name, &o->peer_id))
@@ -1127,8 +1227,8 @@
   }
   GNUNET_free (op_name);
 
-  /* address id */
-  GNUNET_asprintf(&op_name, "op-%u-client-id", op_counter);
+  /* address pid */
+  GNUNET_asprintf(&op_name, "op-%u-client-pid", op_counter);
   if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg,
       sec_name, op_name, &o->client_id))
   {
@@ -1270,7 +1370,7 @@
   char *op_name;
   char *pref;
 
-  /* peer id */
+  /* peer pid */
   GNUNET_asprintf(&op_name, "op-%u-peer-id", op_counter);
   if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg,
       sec_name, op_name, &o->peer_id))
@@ -1282,7 +1382,7 @@
   }
   GNUNET_free (op_name);
 
-  /* address id */
+  /* address pid */
   GNUNET_asprintf(&op_name, "op-%u-address-id", op_counter);
   if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg,
       sec_name, op_name, &o->address_id))
@@ -1346,7 +1446,7 @@
   char *type;
   char *prop;
 
-  /* peer id */
+  /* peer pid */
   GNUNET_asprintf(&op_name, "op-%u-peer-id", op_counter);
   if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg,
       sec_name, op_name, &o->peer_id))
@@ -1358,7 +1458,7 @@
   }
   GNUNET_free (op_name);
 
-  /* address id */
+  /* address pid */
   GNUNET_asprintf(&op_name, "op-%u-address-id", op_counter);
   if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg,
       sec_name, op_name, &o->address_id))
@@ -1503,7 +1603,7 @@
   char *op_name;
   char *pref;
 
-  /* peer id */
+  /* peer pid */
   GNUNET_asprintf(&op_name, "op-%u-peer-id", op_counter);
   if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg,
       sec_name, op_name, &o->peer_id))
@@ -1515,7 +1615,7 @@
   }
   GNUNET_free (op_name);
 
-  /* address id */
+  /* address pid */
   GNUNET_asprintf(&op_name, "op-%u-address-id", op_counter);
   if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg,
       sec_name, op_name, &o->address_id))
@@ -1569,7 +1669,7 @@
 {
   char *op_name;
 
-  /* peer id */
+  /* peer pid */
   GNUNET_asprintf(&op_name, "op-%u-peer-id", op_counter);
   if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg,
       sec_name, op_name, &o->peer_id))
@@ -1592,7 +1692,7 @@
 {
   char *op_name;
 
-  /* peer id */
+  /* peer pid */
   GNUNET_asprintf(&op_name, "op-%u-peer-id", op_counter);
   if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number (cfg,
       sec_name, op_name, &o->peer_id))
@@ -1631,6 +1731,9 @@
       break;
     }
     o = GNUNET_new (struct GNUNET_ATS_TEST_Operation);
+    GNUNET_log (GNUNET_ERROR_TYPE_INFO, "==== Parsing operation %u: `%s'\n",
+        cur->id, op_name);
+
     /* operations = set_rate, start_send, stop_send, set_preference */
     if (0 == strcmp (op, "address_add"))
     {
@@ -2193,6 +2296,17 @@
   else
     GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Experiment name: `%s'\n", e->name);
 
+  if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string(cfg, "experiment",
+      "log_prefix", &e->log_prefix))
+  {
+    fprintf (stderr, "Invalid %s", "name");
+    free_experiment (e);
+    return NULL;
+  }
+  else
+    GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Experiment logging prefix: `%s'\n",
+        e->log_prefix);
+
   if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_filename (cfg, 
"experiment",
       "cfg_file", &e->cfg_file))
   {
@@ -2670,22 +2784,30 @@
   /* Stop all property generation */
   GNUNET_ATS_solver_generate_property_stop_all ();
 
-  /* Clean up experiment */
-  if (NULL != e)
+  if (opt_print)
   {
-    GNUNET_ATS_solvers_experimentation_stop (e);
-    e = NULL;
+    GNUNET_log (GNUNET_ERROR_TYPE_INFO, "== Printing log information \n");
+    GNUNET_ATS_solver_logging_eval (l);
   }
+  if (opt_save)
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_INFO, "== Saving log information \n");
+    GNUNET_ATS_solver_logging_write_to_disk (l);
+  }
 
-  if (opt_print)
-    GNUNET_ATS_solver_logging_eval (l);
-
   if (NULL != l)
   {
     GNUNET_ATS_solver_logging_free (l);
     l = NULL;
   }
 
+  /* Clean up experiment */
+  if (NULL != e)
+  {
+    GNUNET_ATS_solvers_experimentation_stop (e);
+    e = NULL;
+  }
+
   next = peer_head;
   while  (NULL != (cur = next))
   {
@@ -2836,7 +2958,7 @@
   opt_exp_file = NULL;
   opt_solver = NULL;
   opt_log = GNUNET_NO;
-  opt_plot = GNUNET_NO;
+  opt_save = GNUNET_NO;
 
   res = 0;
 
@@ -2848,12 +2970,15 @@
     {  'e', "experiment", NULL,
       gettext_noop ("experiment to use"),
       1, &GNUNET_GETOPT_set_string, &opt_exp_file},
-    {  'e', "experiment", NULL,
-      gettext_noop ("experiment to use"),
-      1, &GNUNET_GETOPT_set_one, &opt_verbose},
+    {  'V', "verbose", NULL,
+      gettext_noop ("be verbose"),
+      0, &GNUNET_GETOPT_set_one, &opt_verbose},
     {  'p', "print", NULL,
       gettext_noop ("print logging"),
       0, &GNUNET_GETOPT_set_one, &opt_print},
+    {  'f', "file", NULL,
+        gettext_noop ("save logging to disk"),
+        0, &GNUNET_GETOPT_set_one, &opt_save},
     GNUNET_GETOPT_OPTION_END
   };
 

Modified: gnunet/src/ats/gnunet-ats-solver-eval.h
===================================================================
--- gnunet/src/ats/gnunet-ats-solver-eval.h     2014-04-16 09:32:06 UTC (rev 
33092)
+++ gnunet/src/ats/gnunet-ats-solver-eval.h     2014-04-16 09:35:10 UTC (rev 
33093)
@@ -25,6 +25,7 @@
  */
 #ifndef GNUNET_ATS_SOLVER_EVAL_H
 #define GNUNET_ATS_SOLVER_EVAL_H
+
 #include "platform.h"
 #include "gnunet_util_lib.h"
 #include "gnunet_ats_plugin.h"
@@ -84,7 +85,22 @@
   GNUNET_ATS_SOLVER_RIL,
 };
 
+struct LoggingFileHandle
+{
+  /* DLL list for logging time steps */
+  struct LoggingFileHandle *next;
+  struct LoggingFileHandle *prev;
 
+  /* peer id */
+  int pid;
+
+  /* address id */
+  int aid;
+
+  struct GNUNET_DISK_FileHandle *f_hd;
+
+};
+
 struct LoggingTimeStep
 {
   struct LoggingTimeStep *prev;
@@ -111,7 +127,6 @@
   struct LoggingAddress *addr_tail;
 };
 
-
 struct LoggingAddress
 {
   struct LoggingAddress *next;
@@ -209,14 +224,15 @@
   GNUNET_SCHEDULER_TaskIdentifier logging_task;
   struct GNUNET_TIME_Relative log_freq;
 
+  /* DLL list for logging time steps */
   struct LoggingTimeStep *head;
-
   struct LoggingTimeStep *tail;
 };
 
 struct Experiment
 {
   char *name;
+  char *log_prefix;
   char *cfg_file;
   struct GNUNET_TIME_Relative log_freq;
   struct GNUNET_TIME_Relative max_duration;
@@ -282,574 +298,5 @@
   struct GNUNET_TIME_Absolute time_start;
 };
 
-
-/* LEGACY */
-
-#if 0
-#define TEST_ATS_PREFERENCE_DEFAULT 1.0
-
-/**
- * Message type sent for traffic generation
- */
-#define TEST_MESSAGE_TYPE_PING 12345
-
-/**
- * Message type sent as response during traffic generation
- */
-#define TEST_MESSAGE_TYPE_PONG 12346
-
-/**
- * Size of test messages
- */
-#define TEST_MESSAGE_SIZE 100
-
-struct BenchmarkPartner;
-
-struct BenchmarkPeer;
-
-struct GNUNET_ATS_TEST_Topology;
-
-struct TrafficGenerator;
-
-
-
-
-
-/**
- * Callback to call when topology setup is completed
- *
- * @param cls the closure
- * @param masters array of master peers
- * @param slaves array of master peers
- */
-typedef void (*GNUNET_ATS_TEST_TopologySetupDoneCallback) (void *cls,
-    struct BenchmarkPeer *masters,
-    struct BenchmarkPeer *slaves);
-
-/**
- * Callback called when logging is required for the data contained
- *
- * @param cls the closure
- * @param address an address
- * @param address_active is address active
- * @param bandwidth_out bandwidth outbound
- * @param bandwidth_in bandwidth inbound
- * @param ats ats information
- * @param ats_count number of ats inforation
- */
-typedef void
-(*GNUNET_ATS_TEST_LogRequest) (void *cls,
-    const struct GNUNET_HELLO_Address *address_id,
-    int address_active,
-    struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out,
-    struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in,
-    const struct GNUNET_ATS_Information *ats,
-    uint32_t ats_count);
-
-/**
- * Information we track for a peer in the testbed.
- */
-struct BenchmarkPeer
-{
-  /**
-   * Handle with testbed.
-   */
-  struct GNUNET_TESTBED_Peer *peer;
-
-  /**
-   * Unique identifier
-   */
-  int no;
-
-  /**
-   * Is this peer a measter: GNUNET_YES/GNUNET_NO
-   */
-  int master;
-
-  /**
-   *  Peer ID
-   */
-  struct GNUNET_PeerIdentity id;
-
-  /**
-   * Testbed operation to get peer information
-   */
-  struct GNUNET_TESTBED_Operation *peer_id_op;
-
-  /**
-   * Testbed operation to connect to ATS performance service
-   */
-  struct GNUNET_TESTBED_Operation *ats_perf_op;
-
-  /**
-   * Testbed operation to connect to core
-   */
-  struct GNUNET_TESTBED_Operation *comm_op;
-
-  /**
-   * ATS performance handle
-   */
-  struct GNUNET_ATS_PerformanceHandle *ats_perf_handle;
-
-  /**
-   * Masters only:
-   * Testbed connect operations to connect masters to slaves
-   */
-  struct TestbedConnectOperation *core_connect_ops;
-
-  /**
-   *  Core handle
-   */
-  struct GNUNET_CORE_Handle *ch;
-
-  /**
-   *  Core handle
-   */
-  struct GNUNET_TRANSPORT_Handle *th;
-
-  /**
-   * Masters only:
-   * Peer to set ATS preferences for
-   */
-  struct BenchmarkPeer *pref_partner;
-
-  /**
-   * Masters only
-   * Progress task
-   */
-  GNUNET_SCHEDULER_TaskIdentifier ats_task;
-
-  /**
-   * Masters only
-   * Progress task
-   */
-  double pref_value;
-
-  /**
-   * Array of partners with num_slaves entries (if master) or
-   * num_master entries (if slave)
-   */
-  struct BenchmarkPartner *partners;
-
-  /**
-   * Number of partners
-   */
-  int num_partners;
-
-  /**
-   * Number of core connections
-   */
-  int core_connections;
-
-  /**
-   * Masters only:
-   * Number of connections to slave peers
-   */
-  int core_slave_connections;
-
-  /**
-   * Total number of messages this peer has sent
-   */
-  unsigned int total_messages_sent;
-
-  /**
-   * Total number of bytes this peer has sent
-   */
-  unsigned int total_bytes_sent;
-
-  /**
-   * Total number of messages this peer has received
-   */
-  unsigned int total_messages_received;
-
-  /**
-   * Total number of bytes this peer has received
-   */
-  unsigned int total_bytes_received;
-};
-
-struct TrafficGenerator
-{
-  struct TrafficGenerator *prev;
-  struct TrafficGenerator *next;
-
-  enum GeneratorType type;
-
-  struct BenchmarkPeer *src;
-  struct BenchmarkPartner *dest;
-
-  long int base_rate;
-  long int max_rate;
-  struct GNUNET_TIME_Relative duration_period;
-
-  GNUNET_SCHEDULER_TaskIdentifier send_task;
-  struct GNUNET_TIME_Absolute next_ping_transmission;
-  struct GNUNET_TIME_Absolute time_start;
-};
-
-
-struct PreferenceGenerator
-{
-  struct PreferenceGenerator *prev;
-  struct PreferenceGenerator *next;
-
-  enum GeneratorType type;
-
-  struct BenchmarkPeer *src;
-  struct BenchmarkPartner *dest;
-
-  enum GNUNET_ATS_PreferenceKind kind;
-
-  long int base_value;
-  long int max_value;
-  struct GNUNET_TIME_Relative duration_period;
-  struct GNUNET_TIME_Relative frequency;
-
-  GNUNET_SCHEDULER_TaskIdentifier set_task;
-  struct GNUNET_TIME_Absolute next_ping_transmission;
-  struct GNUNET_TIME_Absolute time_start;
-};
-
-/**
- * Information about a benchmarking partner
- */
-struct BenchmarkPartner
-{
-  /**
-   * The peer itself this partner belongs to
-   */
-  struct BenchmarkPeer *me;
-
-  /**
-   * The partner peer
-   */
-  struct BenchmarkPeer *dest;
-
-  /**
-   * Core transmit handles
-   */
-  struct GNUNET_CORE_TransmitHandle *cth;
-
-  /**
-   * Transport transmit handles
-   */
-  struct GNUNET_TRANSPORT_TransmitHandle *tth;
-
-  struct TrafficGenerator *tg;
-  struct PreferenceGenerator *pg;
-
-  /**
-   * Timestamp to calculate communication layer delay
-   */
-  struct GNUNET_TIME_Absolute last_message_sent;
-
-  /**
-   * Accumulated RTT for all messages
-   */
-  unsigned int total_app_rtt;
-
-  /**
-   * Number of messages sent to this partner
-   */
-  unsigned int messages_sent;
-
-  /**
-   * Number of bytes sent to this partner
-   */
-  unsigned int bytes_sent;
-
-  /**
-   * Number of messages received from this partner
-   */
-  unsigned int messages_received;
-
-  /**
-   * Number of bytes received from this partner
-   */
-  unsigned int bytes_received;
-
-  /* Current ATS properties */
-
-  uint32_t ats_distance;
-
-  uint32_t ats_delay;
-
-  uint32_t bandwidth_in;
-
-  uint32_t bandwidth_out;
-
-  uint32_t ats_utilization_up;
-
-  uint32_t ats_utilization_down;
-
-  uint32_t ats_network_type;
-
-  uint32_t ats_cost_wan;
-
-  uint32_t ats_cost_lan;
-
-  uint32_t ats_cost_wlan;
-
-  double pref_bandwidth;
-  double pref_delay;
-};
-
-/**
- * Overall state of the performance benchmark
- */
-struct BenchmarkState
-{
-  /**
-   * Are we connected to ATS service of all peers: GNUNET_YES/NO
-   */
-  int connected_ATS_service;
-
-  /**
-   * Are we connected to CORE service of all peers: GNUNET_YES/NO
-   */
-  int connected_COMM_service;
-
-  /**
-   * Are we connected to all peers: GNUNET_YES/NO
-   */
-  int connected_PEERS;
-
-  /**
-   * Are we connected to all slave peers on CORE level: GNUNET_YES/NO
-   */
-  int connected_CORE;
-
-  /**
-   * Are we connected to CORE service of all peers: GNUNET_YES/NO
-   */
-  int benchmarking;
-};
-
-
-struct GNUNET_ATS_TEST_Topology
-{
-  /**
-   * Shutdown task
-   */
-  GNUNET_SCHEDULER_TaskIdentifier shutdown_task;
-
-  /**
-   * Progress task
-   */
-  GNUNET_SCHEDULER_TaskIdentifier progress_task;
-
-  /**
-   * Test result
-   */
-  int result;
-
-  /**Test core (GNUNET_YES) or transport (GNUNET_NO)
-   */
-  int test_core;
-
-  /**
-   * Solver string
-   */
-  char *solver;
-
-  /**
-   * Preference string
-   */
-  char *testname;
-
-  /**
-   * Preference string
-   */
-  char *pref_str;
-
-  /**
-   * ATS preference value
-   */
-  int pref_val;
-
-  /**
-   * Number master peers
-   */
-  unsigned int num_masters;
-
-  /**
-   * Array of master peers
-   */
-  struct BenchmarkPeer *mps;
-
-  /**
-   * Number slave peers
-   */
-  unsigned int num_slaves;
-
-  /**
-   * Array of slave peers
-   */
-  struct BenchmarkPeer *sps;
-
-  /**
-   * Benchmark duration
-   */
-  struct GNUNET_TIME_Relative perf_duration;
-
-  /**
-   * Logging frequency
-   */
-  struct GNUNET_TIME_Relative log_frequency;
-
-  /**
-   * Benchmark state
-   */
-  struct BenchmarkState state;
-
-  struct GNUNET_CORE_MessageHandler *handlers;
-
-  GNUNET_TRANSPORT_ReceiveCallback transport_recv_cb;
-
-  GNUNET_ATS_TEST_TopologySetupDoneCallback done_cb;
-  GNUNET_ATS_AddressInformationCallback ats_perf_cb;
-  void *done_cb_cls;
-};
-
-
-
-/*
- * Experiment related functions
- */
-
-
-/**
- * Execute the specified experiment
- *
- * @param e the Experiment
- * @param ep_done_cb a episode is completed
- * @param e_done_cb the experiment is completed
- */
-void
-GNUNET_ATS_TEST_experimentation_run (struct Experiment *e,
-    GNUNET_ATS_TESTING_EpisodeDoneCallback ep_done_cb,
-    GNUNET_ATS_TESTING_ExperimentDoneCallback e_done_cb);
-
-/**
- * Load an experiment from a file
- *
- * @param filename the file
- * @return the Experiment or NULL on failure
- */
-struct Experiment *
-GNUNET_ATS_TEST_experimentation_load (char *filename);
-
-
-/**
- * Stop an experiment
- *
- * @param e the experiment
- */
-void
-GNUNET_ATS_TEST_experimentation_stop (struct Experiment *e);
-
-/*
- * Traffic related functions
- */
-
-void
-GNUNET_ATS_TEST_traffic_handle_ping (struct BenchmarkPartner *p);
-
-void
-GNUNET_ATS_TEST_traffic_handle_pong (struct BenchmarkPartner *p);
-
-
-/**
- * Generate between the source master and the partner and send traffic with a
- * maximum rate.
- *
- * @param src traffic source
- * @param dest traffic partner
- * @param type type of traffic to generate
- * @param base_rate traffic base rate to send data with
- * @param max_rate  traffic maximum rate to send data with
- * @param period duration of a period of traffic generation (~ 1/frequency)
- * @param duration how long to generate traffic
- * @return the traffic generator
- */
-struct TrafficGenerator *
-GNUNET_ATS_TEST_generate_traffic_start (struct BenchmarkPeer *src,
-    struct BenchmarkPartner *dest,
-    enum GeneratorType type,
-    long int base_rate,
-    long int max_rate,
-    struct GNUNET_TIME_Relative period,
-    struct GNUNET_TIME_Relative duration);
-
-void
-GNUNET_ATS_TEST_generate_traffic_stop (struct TrafficGenerator *tg);
-
-/**
- * Stop all traffic generators
- */
-void
-GNUNET_ATS_TEST_generate_traffic_stop_all ();
-
-struct PreferenceGenerator *
-GNUNET_ATS_TEST_generate_preferences_start (struct BenchmarkPeer *src,
-    struct BenchmarkPartner *dest,
-    enum GeneratorType type,
-    long int base_value,
-    long int value_rate,
-    struct GNUNET_TIME_Relative period,
-    struct GNUNET_TIME_Relative frequency,
-    enum GNUNET_ATS_PreferenceKind kind);
-
-void
-GNUNET_ATS_TEST_generate_preferences_stop (struct PreferenceGenerator *pg);
-
-void
-GNUNET_ATS_TEST_generate_preferences_stop_all ();
-
-/*
- * Logging related functions
- */
-
-
-
-/*
- * Topology related functions
- */
-
-struct BenchmarkPeer *
-GNUNET_ATS_TEST_get_peer (int src);
-
-struct BenchmarkPartner *
-GNUNET_ATS_TEST_get_partner (int src, int dest);
-
-/**
- * Create a topology for ats testing
- *
- * @param name test name
- * @param cfg_file configuration file to use for the peers
- * @param num_slaves number of slaves
- * @param num_masters number of masters
- * @param test_core connect to CORE service (GNUNET_YES) or transport 
(GNUNET_NO)
- * @param done_cb function to call when topology is setup
- * @param done_cb_cls cls for callback
- * @param recv_cb callback to call when data are received
- * @param perf_cb callback to call when performance info are received
- */
-void
-GNUNET_ATS_TEST_create_topology (char *name, char *cfg_file,
-    unsigned int num_slaves,
-    unsigned int num_masters,
-    int test_core,
-    GNUNET_ATS_TEST_TopologySetupDoneCallback done_cb,
-    void *done_cb_cls,
-    GNUNET_TRANSPORT_ReceiveCallback recv_cb,
-    GNUNET_ATS_TEST_LogRequest ats_perf_cb);
-
-/**
- * Shutdown topology
- */
-void
-GNUNET_ATS_TEST_shutdown_topology (void);
-#endif
 #endif /* #ifndef GNUNET_ATS_SOLVER_EVAL_H */
 /* end of file ats-testing.h */




reply via email to

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