GNUnet  0.10.x
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
ats-testing.h File Reference

ats testing library: setup topology and provide logging to test ats More...

#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_testbed_service.h"
#include "gnunet_ats_service.h"
#include "gnunet_core_service.h"
#include "gnunet_transport_service.h"
Include dependency graph for ats-testing.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  TestMessage
 
struct  BenchmarkPeer
 Information we track for a peer in the testbed. More...
 
struct  TrafficGenerator
 
struct  PreferenceGenerator
 
struct  BenchmarkPartner
 Information about a benchmarking partner. More...
 
struct  BenchmarkState
 Overall state of the performance benchmark. More...
 
struct  GNUNET_ATS_TEST_Topology
 
struct  GNUNET_ATS_TEST_Operation
 An operation in an experiment. More...
 
struct  Episode
 
struct  Experiment
 

Macros

#define TEST_ATS_PREFERENCE_DEFAULT   1.0
 
#define TEST_MESSAGE_TYPE_PING   12345
 Message type sent for traffic generation. More...
 
#define TEST_MESSAGE_TYPE_PONG   12346
 Message type sent as response during traffic generation. More...
 
#define TEST_MESSAGE_SIZE   100
 Size of test messages. More...
 

Typedefs

typedef void(* GNUNET_ATS_TEST_TopologySetupDoneCallback) (void *cls, struct BenchmarkPeer *masters, struct BenchmarkPeer *slaves)
 Callback to call when topology setup is completed. More...
 
typedef void(* GNUNET_ATS_TEST_LogRequest) (void *cls, const struct GNUNET_HELLO_Address *address, int address_active, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, const struct GNUNET_ATS_Properties *prop)
 Callback called when logging is required for the data contained. More...
 
typedef void(* GNUNET_ATS_TESTING_EpisodeDoneCallback) (struct Episode *e)
 
typedef void(* GNUNET_ATS_TESTING_ExperimentDoneCallback) (struct Experiment *e, struct GNUNET_TIME_Relative duration, int success)
 

Enumerations

enum  GeneratorType {
  GNUNET_ATS_TEST_TG_LINEAR, GNUNET_ATS_TEST_TG_CONSTANT, GNUNET_ATS_TEST_TG_RANDOM, GNUNET_ATS_TEST_TG_SINUS,
  GNUNET_ATS_TEST_TG_LINEAR, GNUNET_ATS_TEST_TG_CONSTANT, GNUNET_ATS_TEST_TG_RANDOM, GNUNET_ATS_TEST_TG_SINUS
}
 
enum  OperationType {
  SOLVER_OP_ADD_ADDRESS, SOLVER_OP_DEL_ADDRESS, SOLVER_OP_START_SET_PROPERTY, SOLVER_OP_STOP_SET_PROPERTY,
  SOLVER_OP_START_SET_PREFERENCE, SOLVER_OP_STOP_SET_PREFERENCE, SOLVER_OP_START_REQUEST, SOLVER_OP_STOP_REQUEST,
  START_SEND, STOP_SEND, START_PREFERENCE, STOP_PREFERENCE,
  OP_PEER_CREATE, OP_PEER_START, OP_PEER_STOP, OP_PEER_DESTROY,
  OP_PEER_INFO, OP_PEER_RECONFIGURE, OP_OVERLAY_CONNECT, OP_FORWARDED,
  OP_LINK_CONTROLLERS, OP_GET_SLAVE_CONFIG, OP_SHUTDOWN_PEERS, OP_MANAGE_SERVICE
}
 

Functions

void GNUNET_ATS_TEST_experimentation_run (struct Experiment *e, GNUNET_ATS_TESTING_EpisodeDoneCallback ep_done_cb, GNUNET_ATS_TESTING_ExperimentDoneCallback e_done_cb)
 Execute the specified experiment. More...
 
struct ExperimentGNUNET_ATS_TEST_experimentation_load (const char *filename)
 Load an experiment from a file. More...
 
void GNUNET_ATS_TEST_experimentation_stop (struct Experiment *e)
 Stop an experiment. More...
 
void GNUNET_ATS_TEST_traffic_handle_ping (struct BenchmarkPartner *p)
 
void GNUNET_ATS_TEST_traffic_handle_pong (struct BenchmarkPartner *p)
 
struct TrafficGeneratorGNUNET_ATS_TEST_generate_traffic_start (struct BenchmarkPeer *src, struct BenchmarkPartner *dest, enum GeneratorType type, unsigned int base_rate, unsigned int max_rate, struct GNUNET_TIME_Relative period, struct GNUNET_TIME_Relative duration)
 Generate between the source master and the partner and send traffic with a maximum rate. More...
 
void GNUNET_ATS_TEST_generate_traffic_stop (struct TrafficGenerator *tg)
 
void GNUNET_ATS_TEST_generate_traffic_stop_all (void)
 Stop all traffic generators. More...
 
struct PreferenceGeneratorGNUNET_ATS_TEST_generate_preferences_start (struct BenchmarkPeer *src, struct BenchmarkPartner *dest, enum GeneratorType type, unsigned int base_value, unsigned int value_rate, struct GNUNET_TIME_Relative period, struct GNUNET_TIME_Relative frequency, enum GNUNET_ATS_PreferenceKind kind)
 Generate between the source master and the partner and set preferences with a value depending on the generator. More...
 
void GNUNET_ATS_TEST_generate_preferences_stop (struct PreferenceGenerator *pg)
 
void GNUNET_ATS_TEST_generate_preferences_stop_all (void)
 Stop all preferences generators. More...
 
struct LoggingHandleGNUNET_ATS_TEST_logging_start (struct GNUNET_TIME_Relative log_frequency, const char *testname, struct BenchmarkPeer *masters, int num_masters, int num_slaves, int verbose)
 Start logging. More...
 
void GNUNET_ATS_TEST_logging_clean_up (struct LoggingHandle *l)
 Stop logging. More...
 
void GNUNET_ATS_TEST_logging_stop (struct LoggingHandle *l)
 Stop logging. More...
 
void GNUNET_ATS_TEST_logging_now (struct LoggingHandle *l)
 Log all data now. More...
 
void GNUNET_ATS_TEST_logging_write_to_file (struct LoggingHandle *l, const char *test_name, int plots)
 Write logging data to file. More...
 
struct BenchmarkPeerGNUNET_ATS_TEST_get_peer (int src)
 Topology related functions. More...
 
struct BenchmarkPartnerGNUNET_ATS_TEST_get_partner (int src, int dest)
 
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_ATS_TEST_LogRequest ats_perf_cb)
 Create a topology for ats testing. More...
 
void GNUNET_ATS_TEST_shutdown_topology (void)
 Shutdown topology. More...
 

Variables

struct GNUNET_CONFIGURATION_Handlecfg
 Handle to our configuration. More...
 

Detailed Description

ats testing library: setup topology and provide logging to test ats

Author
Christian Grothoff
Matthias Wachs

Definition in file ats-testing.h.

Macro Definition Documentation

◆ TEST_ATS_PREFERENCE_DEFAULT

#define TEST_ATS_PREFERENCE_DEFAULT   1.0

Definition at line 33 of file ats-testing.h.

Referenced by main_run().

◆ TEST_MESSAGE_TYPE_PING

#define TEST_MESSAGE_TYPE_PING   12345

Message type sent for traffic generation.

Definition at line 38 of file ats-testing.h.

Referenced by comm_schedule_send(), core_connect_adapter(), GNUNET_ATS_TEST_traffic_handle_ping(), and transport_connect_adapter().

◆ TEST_MESSAGE_TYPE_PONG

#define TEST_MESSAGE_TYPE_PONG   12346

Message type sent as response during traffic generation.

Definition at line 43 of file ats-testing.h.

Referenced by core_connect_adapter(), and transport_connect_adapter().

◆ TEST_MESSAGE_SIZE

#define TEST_MESSAGE_SIZE   100

Typedef Documentation

◆ GNUNET_ATS_TEST_TopologySetupDoneCallback

typedef void(* GNUNET_ATS_TEST_TopologySetupDoneCallback) (void *cls, struct BenchmarkPeer *masters, struct BenchmarkPeer *slaves)

Callback to call when topology setup is completed.

Parameters
clsthe closure
mastersarray of master peers
slavesarray of master peers

Definition at line 85 of file ats-testing.h.

◆ GNUNET_ATS_TEST_LogRequest

typedef void(* GNUNET_ATS_TEST_LogRequest) (void *cls, const struct GNUNET_HELLO_Address *address, int address_active, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_out, struct GNUNET_BANDWIDTH_Value32NBO bandwidth_in, const struct GNUNET_ATS_Properties *prop)

Callback called when logging is required for the data contained.

Parameters
clsthe closure
addressan address
address_activeis address active
bandwidth_outbandwidth outbound
bandwidth_inbandwidth inbound
propperformance information

Definition at line 100 of file ats-testing.h.

◆ GNUNET_ATS_TESTING_EpisodeDoneCallback

typedef void(* GNUNET_ATS_TESTING_EpisodeDoneCallback) (struct Episode *e)

Definition at line 482 of file ats-testing.h.

◆ GNUNET_ATS_TESTING_ExperimentDoneCallback

typedef void(* GNUNET_ATS_TESTING_ExperimentDoneCallback) (struct Experiment *e, struct GNUNET_TIME_Relative duration, int success)

Definition at line 484 of file ats-testing.h.

Enumeration Type Documentation

◆ GeneratorType

Enumerator
GNUNET_ATS_TEST_TG_LINEAR 
GNUNET_ATS_TEST_TG_CONSTANT 
GNUNET_ATS_TEST_TG_RANDOM 
GNUNET_ATS_TEST_TG_SINUS 
GNUNET_ATS_TEST_TG_LINEAR 
GNUNET_ATS_TEST_TG_CONSTANT 
GNUNET_ATS_TEST_TG_RANDOM 
GNUNET_ATS_TEST_TG_SINUS 

Definition at line 69 of file ats-testing.h.

◆ OperationType

Enumerator
SOLVER_OP_ADD_ADDRESS 
SOLVER_OP_DEL_ADDRESS 
SOLVER_OP_START_SET_PROPERTY 
SOLVER_OP_STOP_SET_PROPERTY 
SOLVER_OP_START_SET_PREFERENCE 
SOLVER_OP_STOP_SET_PREFERENCE 
SOLVER_OP_START_REQUEST 
SOLVER_OP_STOP_REQUEST 
START_SEND 
STOP_SEND 
START_PREFERENCE 
STOP_PREFERENCE 
OP_PEER_CREATE 

Peer create operation.

OP_PEER_START 

Peer start operation.

OP_PEER_STOP 

Peer stop operation.

OP_PEER_DESTROY 

Peer destroy operation.

OP_PEER_INFO 

Get peer information operation.

OP_PEER_RECONFIGURE 

Reconfigure a peer.

OP_OVERLAY_CONNECT 

Overlay connection operation.

OP_FORWARDED 

Forwarded operation.

OP_LINK_CONTROLLERS 

Link controllers operation.

OP_GET_SLAVE_CONFIG 

Get slave config operation.

OP_SHUTDOWN_PEERS 

Stop and destroy all peers.

OP_MANAGE_SERVICE 

Start/stop service at a peer.

Definition at line 470 of file ats-testing.h.

Function Documentation

◆ GNUNET_ATS_TEST_experimentation_run()

void GNUNET_ATS_TEST_experimentation_run ( struct Experiment e,
GNUNET_ATS_TESTING_EpisodeDoneCallback  ep_done_cb,
GNUNET_ATS_TESTING_ExperimentDoneCallback  e_done_cb 
)

Execute the specified experiment.

Parameters
ethe Experiment
ep_done_cba episode is completed
e_done_cbthe experiment is completed

Definition at line 615 of file ats-testing-experiment.c.

References Experiment::cur, Episode::duration, Experiment::e_done_cb, enforce_episode(), Experiment::ep_done_cb, Experiment::episode_timeout_task, Experiment::experiment_timeout_task, GNUNET_SCHEDULER_add_delayed(), GNUNET_STRINGS_relative_time_to_string(), GNUNET_TIME_absolute_get(), GNUNET_YES, Episode::id, Experiment::max_duration, Experiment::name, Experiment::start, Experiment::start_time, timeout_episode(), and timeout_experiment().

Referenced by topology_setup_done().

618 {
619  fprintf (stderr, "Running experiment `%s' with timeout %s\n", e->name,
621  e->e_done_cb = e_done_cb;
622  e->ep_done_cb = ep_done_cb;
624 
625  /* Start total time out */
627  &timeout_experiment, e);
628 
629  /* Start */
630  e->cur = e->start;
631  fprintf (stderr, "Running episode %u with timeout %s\n",
632  e->cur->id,
634  enforce_episode(e->cur);
636  &timeout_episode, e);
637 
638 
639 }
struct Episode * start
GNUNET_ATS_TESTING_EpisodeDoneCallback ep_done_cb
GNUNET_ATS_TESTING_ExperimentDoneCallback e_done_cb
static void timeout_experiment(void *cls)
struct GNUNET_SCHEDULER_Task * experiment_timeout_task
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_delayed(struct GNUNET_TIME_Relative delay, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay.
Definition: scheduler.c:1246
struct Episode * cur
const char * GNUNET_STRINGS_relative_time_to_string(struct GNUNET_TIME_Relative delta, int do_round)
Give relative time in human-readable fancy format.
Definition: strings.c:727
struct GNUNET_SCHEDULER_Task * episode_timeout_task
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_get(void)
Get the current time.
Definition: time.c:118
struct GNUNET_TIME_Relative duration
struct GNUNET_TIME_Absolute start_time
static void enforce_episode(struct Episode *ep)
static void timeout_episode(void *cls)
#define GNUNET_YES
Definition: gnunet_common.h:80
struct GNUNET_TIME_Relative max_duration
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_ATS_TEST_experimentation_load()

struct Experiment* GNUNET_ATS_TEST_experimentation_load ( const char *  filename)

Load an experiment from a file.

Parameters
filenamethe file
Returns
the Experiment or NULL on failure

Definition at line 643 of file ats-testing-experiment.c.

References cfg, Experiment::cfg_file, create_experiment(), e, free_experiment(), GNUNET_CONFIGURATION_create(), GNUNET_CONFIGURATION_destroy(), GNUNET_CONFIGURATION_get_value_filename(), GNUNET_CONFIGURATION_get_value_number(), GNUNET_CONFIGURATION_get_value_string(), GNUNET_CONFIGURATION_get_value_time(), GNUNET_CONFIGURATION_load(), GNUNET_STRINGS_relative_time_to_string(), GNUNET_SYSERR, GNUNET_YES, load_episodes(), Experiment::log_freq, Experiment::max_duration, Experiment::name, Experiment::num_episodes, Experiment::num_masters, Experiment::num_slaves, and Experiment::total_duration.

Referenced by main().

644 {
645  struct Experiment *e;
647  e = NULL;
648 
651  {
652  fprintf (stderr, "Failed to load `%s'\n", filename);
654  return NULL;
655  }
656 
657  e = create_experiment ();
658 
659  if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_string(cfg, "experiment",
660  "name", &e->name))
661  {
662  fprintf (stderr, "Invalid %s", "name");
663  free_experiment (e);
664  return NULL;
665  }
666  else
667  fprintf (stderr, "Experiment name: `%s'\n", e->name);
668 
669  if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_filename (cfg, "experiment",
670  "cfg_file", &e->cfg_file))
671  {
672  fprintf (stderr, "Invalid %s", "cfg_file");
673  free_experiment (e);
674  return NULL;
675  }
676  else
677  fprintf (stderr, "Experiment name: `%s'\n", e->cfg_file);
678 
679  if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number(cfg, "experiment",
680  "masters", &e->num_masters))
681  {
682  fprintf (stderr, "Invalid %s", "masters");
683  free_experiment (e);
684  return NULL;
685  }
686  else
687  fprintf (stderr, "Experiment masters: `%llu'\n",
688  e->num_masters);
689 
690  if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_number(cfg, "experiment",
691  "slaves", &e->num_slaves))
692  {
693  fprintf (stderr, "Invalid %s", "slaves");
694  free_experiment (e);
695  return NULL;
696  }
697  else
698  fprintf (stderr, "Experiment slaves: `%llu'\n",
699  e->num_slaves);
700 
701  if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_time(cfg, "experiment",
702  "log_freq", &e->log_freq))
703  {
704  fprintf (stderr, "Invalid %s", "log_freq");
705  free_experiment (e);
706  return NULL;
707  }
708  else
709  fprintf (stderr, "Experiment logging frequency: `%s'\n",
711 
712  if (GNUNET_SYSERR == GNUNET_CONFIGURATION_get_value_time(cfg, "experiment",
713  "max_duration", &e->max_duration))
714  {
715  fprintf (stderr, "Invalid %s", "max_duration");
716  free_experiment (e);
717  return NULL;
718  }
719  else
720  fprintf (stderr, "Experiment duration: `%s'\n",
722 
723  load_episodes (e, cfg);
724  fprintf (stderr, "Loaded %u episodes with total duration %s\n",
725  e->num_episodes,
727 
729  return e;
730 }
static struct Experiment * create_experiment()
int GNUNET_CONFIGURATION_get_value_time(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, struct GNUNET_TIME_Relative *time)
Get a configuration value that should be a relative time.
int GNUNET_CONFIGURATION_get_value_number(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, unsigned long long *number)
Get a configuration value that should be a number.
unsigned long long int num_masters
Definition: ats-testing.h:525
struct GNUNET_TIME_Relative total_duration
static struct Experiment * e
unsigned int num_episodes
struct GNUNET_CONFIGURATION_Handle * GNUNET_CONFIGURATION_create(void)
Create a new configuration object.
static int load_episodes(struct Experiment *e, struct GNUNET_CONFIGURATION_Handle *cfg)
static void free_experiment(struct Experiment *e)
int GNUNET_CONFIGURATION_load(struct GNUNET_CONFIGURATION_Handle *cfg, const char *filename)
Load configuration.
struct GNUNET_TIME_Relative log_freq
const char * GNUNET_STRINGS_relative_time_to_string(struct GNUNET_TIME_Relative delta, int do_round)
Give relative time in human-readable fancy format.
Definition: strings.c:727
void GNUNET_CONFIGURATION_destroy(struct GNUNET_CONFIGURATION_Handle *cfg)
Destroy configuration object.
unsigned long long int num_slaves
Definition: ats-testing.h:526
static char * filename
int GNUNET_CONFIGURATION_get_value_string(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, char **value)
Get a configuration value that should be a string.
static struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
Definition: gnunet-arm.c:104
#define GNUNET_SYSERR
Definition: gnunet_common.h:79
configuration data
Definition: configuration.c:85
int GNUNET_CONFIGURATION_get_value_filename(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, char **value)
Get a configuration value that should be the name of a file or directory.
#define GNUNET_YES
Definition: gnunet_common.h:80
struct GNUNET_TIME_Relative max_duration
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_ATS_TEST_experimentation_stop()

void GNUNET_ATS_TEST_experimentation_stop ( struct Experiment e)

Stop an experiment.

Parameters
ethe experiment

Definition at line 733 of file ats-testing-experiment.c.

References Experiment::episode_timeout_task, Experiment::experiment_timeout_task, free_experiment(), and GNUNET_SCHEDULER_cancel().

Referenced by do_shutdown().

734 {
735  if (NULL != e->experiment_timeout_task)
736  {
738  e->experiment_timeout_task = NULL;
739  }
740  if (NULL != e->episode_timeout_task)
741  {
743  e->episode_timeout_task = NULL;
744  }
745  free_experiment (e);
746 }
static void free_experiment(struct Experiment *e)
struct GNUNET_SCHEDULER_Task * experiment_timeout_task
struct GNUNET_SCHEDULER_Task * episode_timeout_task
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:965
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_ATS_TEST_traffic_handle_ping()

void GNUNET_ATS_TEST_traffic_handle_ping ( struct BenchmarkPartner p)

Definition at line 169 of file ats-testing-traffic.c.

References BenchmarkPartner::bytes_received, BenchmarkPartner::dest, env, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_MQ_msg, GNUNET_MQ_notify_sent(), GNUNET_MQ_send(), BenchmarkPartner::me, BenchmarkPartner::messages_received, BenchmarkPartner::mq, msg, BenchmarkPeer::no, TestMessage::padding, TEST_MESSAGE_SIZE, TEST_MESSAGE_TYPE_PING, BenchmarkPeer::total_bytes_received, BenchmarkPeer::total_messages_received, and update_pong_data().

Referenced by handle_ping().

170 {
171  struct TestMessage *msg;
172  struct GNUNET_MQ_Envelope *env;
173 
175  "Slave [%u]: Received PING from [%u], sending PONG\n",
176  p->me->no,
177  p->dest->no);
178  p->messages_received++;
182 
183 
184  env = GNUNET_MQ_msg (msg,
186  memset (msg->padding,
187  'a',
188  sizeof (msg->padding));
191  p);
192  GNUNET_MQ_send (p->mq,
193  env);
194 }
unsigned int total_bytes_received
Total number of bytes this peer has received.
Definition: ats-testing.h:227
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
unsigned int total_messages_received
Total number of messages this peer has received.
Definition: ats-testing.h:222
#define TEST_MESSAGE_TYPE_PING
Message type sent for traffic generation.
Definition: ats-testing.h:38
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
Definition: gnunet_mq_lib.h:67
unsigned int bytes_received
Number of bytes received from this partner.
Definition: ats-testing.h:330
uint8_t padding[100 - sizeof(struct GNUNET_MessageHeader)]
Definition: ats-testing.h:55
int no
Unique identifier.
Definition: ats-testing.h:121
void GNUNET_MQ_notify_sent(struct GNUNET_MQ_Envelope *ev, GNUNET_SCHEDULER_TaskCallback cb, void *cb_cls)
Call a callback once the envelope has been sent, that is, sending it can not be canceled anymore...
Definition: mq.c:774
unsigned int messages_received
Number of messages received from this partner.
Definition: ats-testing.h:325
struct GNUNET_MQ_Envelope * env
Definition: 005.c:1
struct GNUNET_MQ_Handle * mq
Message queue handle.
Definition: ats-testing.h:290
#define GNUNET_log(kind,...)
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
Definition: mq.c:353
static void update_pong_data(void *cls)
struct BenchmarkPeer * me
The peer itself this partner belongs to.
Definition: ats-testing.h:280
struct BenchmarkPeer * dest
The partner peer.
Definition: ats-testing.h:285
#define TEST_MESSAGE_SIZE
Size of test messages.
Definition: ats-testing.h:48
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_ATS_TEST_traffic_handle_pong()

void GNUNET_ATS_TEST_traffic_handle_pong ( struct BenchmarkPartner p)

Definition at line 198 of file ats-testing-traffic.c.

References TrafficGenerator::base_rate, BenchmarkPartner::bytes_received, comm_schedule_send(), BenchmarkPartner::dest, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_SCHEDULER_add_delayed(), GNUNET_SCHEDULER_add_now(), GNUNET_TIME_absolute_get(), GNUNET_TIME_absolute_get_difference(), GNUNET_TIME_absolute_get_remaining(), GNUNET_TIME_relative_min(), GNUNET_TIME_UNIT_SECONDS, BenchmarkPartner::last_message_sent, BenchmarkPartner::me, BenchmarkPartner::messages_received, TrafficGenerator::next_ping_transmission, BenchmarkPeer::no, GNUNET_TIME_Relative::rel_value_us, TrafficGenerator::send_task, TEST_MESSAGE_SIZE, BenchmarkPartner::tg, BenchmarkPartner::total_app_rtt, BenchmarkPeer::total_bytes_received, and BenchmarkPeer::total_messages_received.

Referenced by handle_pong().

199 {
200  struct GNUNET_TIME_Relative left;
202  "Master [%u]: Received PONG from [%u], next message\n",
203  p->me->no,
204  p->dest->no);
205 
206  p->messages_received++;
212 
213  /* Schedule next send event */
214  if (NULL == p->tg)
215  return;
216 
218  if (UINT32_MAX == p->tg->base_rate)
219  {
221  }
222  else if (0 == left.rel_value_us)
223  {
225  }
226  else
227  {
228  /* Enforce minimum transmission rate 1 msg / sec */
231  "Enforcing minimum send rate between master [%u] and slave [%u]\n",
232  p->me->no, p->dest->no);
234  &comm_schedule_send, p);
235  }
236 }
unsigned int total_bytes_received
Total number of bytes this peer has received.
Definition: ats-testing.h:227
uint64_t rel_value_us
The actual value.
static void comm_schedule_send(void *cls)
#define GNUNET_TIME_UNIT_SECONDS
One second.
unsigned int total_messages_received
Total number of messages this peer has received.
Definition: ats-testing.h:222
unsigned int bytes_received
Number of bytes received from this partner.
Definition: ats-testing.h:330
struct GNUNET_SCHEDULER_Task * send_task
Definition: ats-testing.h:244
struct TrafficGenerator * tg
Handle for traffic generator.
Definition: ats-testing.h:295
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_delayed(struct GNUNET_TIME_Relative delay, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay.
Definition: scheduler.c:1246
int no
Unique identifier.
Definition: ats-testing.h:121
unsigned int total_app_rtt
Accumulated RTT for all messages.
Definition: ats-testing.h:310
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_now(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run as soon as possible.
Definition: scheduler.c:1273
unsigned int messages_received
Number of messages received from this partner.
Definition: ats-testing.h:325
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_get(void)
Get the current time.
Definition: time.c:118
struct GNUNET_TIME_Relative GNUNET_TIME_relative_min(struct GNUNET_TIME_Relative t1, struct GNUNET_TIME_Relative t2)
Return the minimum of two relative time values.
Definition: time.c:271
struct GNUNET_TIME_Absolute last_message_sent
Timestamp to calculate communication layer delay.
Definition: ats-testing.h:305
long int base_rate
Definition: ats-testing.h:240
#define GNUNET_log(kind,...)
struct GNUNET_TIME_Relative GNUNET_TIME_absolute_get_remaining(struct GNUNET_TIME_Absolute future)
Given a timestamp in the future, how much time remains until then?
Definition: time.c:331
struct GNUNET_TIME_Relative GNUNET_TIME_absolute_get_difference(struct GNUNET_TIME_Absolute start, struct GNUNET_TIME_Absolute end)
Compute the time difference between the given start and end times.
Definition: time.c:353
struct BenchmarkPeer * me
The peer itself this partner belongs to.
Definition: ats-testing.h:280
struct BenchmarkPeer * dest
The partner peer.
Definition: ats-testing.h:285
struct GNUNET_TIME_Absolute next_ping_transmission
Definition: ats-testing.h:245
#define TEST_MESSAGE_SIZE
Size of test messages.
Definition: ats-testing.h:48
Time for relative time used by GNUnet, in microseconds.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_ATS_TEST_generate_traffic_start()

struct TrafficGenerator* GNUNET_ATS_TEST_generate_traffic_start ( struct BenchmarkPeer src,
struct BenchmarkPartner dest,
enum GeneratorType  type,
unsigned int  base_rate,
unsigned int  max_rate,
struct GNUNET_TIME_Relative  period,
struct GNUNET_TIME_Relative  duration 
)

Generate between the source master and the partner and send traffic with a maximum rate.

Parameters
srctraffic source
desttraffic partner
typetype of traffic to generate
base_ratetraffic base rate to send data with
max_ratetraffic maximum rate to send data with
periodduration of a period of traffic generation (~ 1/frequency)
durationhow long to generate traffic
Returns
the traffic generator

Definition at line 253 of file ats-testing-traffic.c.

References TrafficGenerator::base_rate, comm_schedule_send(), TrafficGenerator::dest, BenchmarkPartner::dest, TrafficGenerator::duration_period, GNUNET_ATS_TEST_TG_CONSTANT, GNUNET_ATS_TEST_TG_LINEAR, GNUNET_ATS_TEST_TG_RANDOM, GNUNET_ATS_TEST_TG_SINUS, GNUNET_break, GNUNET_CONTAINER_DLL_insert, GNUNET_ERROR_TYPE_INFO, GNUNET_i2s(), GNUNET_log, GNUNET_new, GNUNET_SCHEDULER_add_now(), GNUNET_TIME_absolute_get(), GNUNET_TIME_UNIT_FOREVER_ABS, BenchmarkPeer::id, TrafficGenerator::max_rate, BenchmarkPartner::me, TrafficGenerator::next_ping_transmission, BenchmarkPeer::no, TrafficGenerator::send_task, TrafficGenerator::src, BenchmarkPartner::tg, TrafficGenerator::time_start, type, and TrafficGenerator::type.

Referenced by enforce_start_send(), and topology_setup_done().

260 {
261  struct TrafficGenerator *tg;
262 
263  if (NULL != dest->tg)
264  {
265  GNUNET_break (0);
266  return NULL;
267  }
268 
269  tg = GNUNET_new (struct TrafficGenerator);
271  tg_tail,
272  tg);
273  tg->type = type;
274  tg->src = src;
275  tg->dest = dest;
276  tg->base_rate = base_rate;
277  tg->max_rate = max_rate;
278  tg->duration_period = period;
281 
282  switch (type) {
285  "Setting up constant traffic generator master[%u] `%s' and slave [%u] `%s' max %u Bips\n",
286  dest->me->no,
287  GNUNET_i2s (&dest->me->id),
288  dest->dest->no,
289  GNUNET_i2s (&dest->dest->id),
290  base_rate);
291  break;
294  "Setting up linear traffic generator master[%u] `%s' and slave [%u] `%s' min %u Bips max %u Bips\n",
295  dest->me->no,
296  GNUNET_i2s (&dest->me->id),
297  dest->dest->no,
298  GNUNET_i2s (&dest->dest->id),
299  base_rate,
300  max_rate);
301  break;
304  "Setting up sinus traffic generator master[%u] `%s' and slave [%u] `%s' baserate %u Bips, amplitude %u Bps\n",
305  dest->me->no,
306  GNUNET_i2s (&dest->me->id),
307  dest->dest->no,
308  GNUNET_i2s (&dest->dest->id),
309  base_rate,
310  max_rate);
311  break;
314  "Setting up random traffic generator master[%u] `%s' and slave [%u] `%s' min %u Bips max %u Bps\n",
315  dest->me->no,
316  GNUNET_i2s (&dest->me->id),
317  dest->dest->no,
318  GNUNET_i2s (&dest->dest->id),
319  base_rate,
320  max_rate);
321  break;
322  default:
323  break;
324  }
325 
326  dest->tg = tg;
327  tg->send_task
329  dest);
330  return tg;
331 }
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
static struct TrafficGenerator * tg_head
static void comm_schedule_send(void *cls)
long int max_rate
Definition: ats-testing.h:241
struct GNUNET_SCHEDULER_Task * send_task
Definition: ats-testing.h:244
#define GNUNET_new(type)
Allocate a struct or union of the given type.
struct BenchmarkPartner * dest
Definition: ats-testing.h:238
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
#define GNUNET_TIME_UNIT_FOREVER_ABS
Constant used to specify "forever".
struct TrafficGenerator * tg
Handle for traffic generator.
Definition: ats-testing.h:295
int no
Unique identifier.
Definition: ats-testing.h:121
struct GNUNET_TIME_Absolute time_start
Definition: ats-testing.h:246
static struct TrafficGenerator * tg_tail
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_now(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run as soon as possible.
Definition: scheduler.c:1273
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_get(void)
Get the current time.
Definition: time.c:118
enum GeneratorType type
Definition: ats-testing.h:235
struct BenchmarkPeer * src
Definition: ats-testing.h:237
long int base_rate
Definition: ats-testing.h:240
#define GNUNET_log(kind,...)
struct GNUNET_TIME_Relative duration_period
Definition: ats-testing.h:242
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
struct BenchmarkPeer * me
The peer itself this partner belongs to.
Definition: ats-testing.h:280
const char * GNUNET_i2s(const struct GNUNET_PeerIdentity *pid)
Convert a peer identity to a string (for printing debug messages).
struct BenchmarkPeer * dest
The partner peer.
Definition: ats-testing.h:285
struct GNUNET_PeerIdentity id
Peer ID.
Definition: ats-testing.h:131
struct GNUNET_TIME_Absolute next_ping_transmission
Definition: ats-testing.h:245
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_ATS_TEST_generate_traffic_stop()

void GNUNET_ATS_TEST_generate_traffic_stop ( struct TrafficGenerator tg)

Definition at line 335 of file ats-testing-traffic.c.

References TrafficGenerator::dest, GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_SCHEDULER_cancel(), TrafficGenerator::send_task, and BenchmarkPartner::tg.

Referenced by enforce_start_send(), enforce_stop_send(), and GNUNET_ATS_TEST_generate_traffic_stop_all().

336 {
338  tg_tail,
339  tg);
340  tg->dest->tg = NULL;
341  if (NULL != tg->send_task)
342  {
344  tg->send_task = NULL;
345  }
346  GNUNET_free (tg);
347 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
static struct TrafficGenerator * tg_head
struct GNUNET_SCHEDULER_Task * send_task
Definition: ats-testing.h:244
struct BenchmarkPartner * dest
Definition: ats-testing.h:238
struct TrafficGenerator * tg
Handle for traffic generator.
Definition: ats-testing.h:295
static struct TrafficGenerator * tg_tail
#define GNUNET_free(ptr)
Wrapper around free.
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:965
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_ATS_TEST_generate_traffic_stop_all()

void GNUNET_ATS_TEST_generate_traffic_stop_all ( void  )

Stop all traffic generators.

Definition at line 354 of file ats-testing-traffic.c.

References GNUNET_ATS_TEST_generate_traffic_stop(), TrafficGenerator::next, and tg_head.

Referenced by do_shutdown(), and experiment_done_cb().

355 {
356  struct TrafficGenerator *cur;
357  struct TrafficGenerator *next;
358 
359  next = tg_head;
360  for (cur = next; NULL != cur; cur = next)
361  {
362  next = cur->next;
364  }
365 }
struct TrafficGenerator * next
Definition: ats-testing.h:233
static struct TrafficGenerator * tg_head
void GNUNET_ATS_TEST_generate_traffic_stop(struct TrafficGenerator *tg)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_ATS_TEST_generate_preferences_start()

struct PreferenceGenerator* GNUNET_ATS_TEST_generate_preferences_start ( struct BenchmarkPeer src,
struct BenchmarkPartner dest,
enum GeneratorType  type,
unsigned int  base_value,
unsigned int  value_rate,
struct GNUNET_TIME_Relative  period,
struct GNUNET_TIME_Relative  frequency,
enum GNUNET_ATS_PreferenceKind  kind 
)

Generate between the source master and the partner and set preferences with a value depending on the generator.

Parameters
srcsource
destpartner
typetype of preferences to generate
base_valuetraffic base rate to send data with
value_ratetraffic maximum rate to send data with
periodduration of a period of preferences generation (~ 1/frequency)
frequencyhow long to generate preferences
kindATS preference to generate
Returns
the traffic generator
Parameters
srcsource
destpartner
typetype of preferences to generate
base_valuetraffic base rate to send data with
value_ratetraffic maximum rate to send data with
periodduration of a period of preferences generation (~ 1/frequency)
frequencyhow long to generate preferences
kindATS preference to generate
Returns
the preference generator

Definition at line 145 of file ats-testing-preferences.c.

References PreferenceGenerator::base_value, PreferenceGenerator::dest, BenchmarkPartner::dest, PreferenceGenerator::duration_period, PreferenceGenerator::frequency, GNUNET_ATS_TEST_TG_CONSTANT, GNUNET_ATS_TEST_TG_LINEAR, GNUNET_ATS_TEST_TG_RANDOM, GNUNET_ATS_TEST_TG_SINUS, GNUNET_break, GNUNET_CONTAINER_DLL_insert, GNUNET_ERROR_TYPE_INFO, GNUNET_i2s(), GNUNET_log, GNUNET_new, GNUNET_SCHEDULER_add_now(), GNUNET_TIME_absolute_get(), BenchmarkPeer::id, PreferenceGenerator::kind, PreferenceGenerator::max_value, BenchmarkPartner::me, BenchmarkPeer::no, BenchmarkPartner::pg, set_pref_task(), PreferenceGenerator::set_task, PreferenceGenerator::src, PreferenceGenerator::time_start, type, and PreferenceGenerator::type.

Referenced by enforce_start_preference().

153 {
154  struct PreferenceGenerator *pg;
155 
156  if (NULL != dest->pg)
157  {
158  GNUNET_break (0);
159  return NULL;
160  }
161 
162  pg = GNUNET_new (struct PreferenceGenerator);
164  pg->type = type;
165  pg->src = src;
166  pg->dest = dest;
167  pg->kind = kind;
168  pg->base_value = base_value;
169  pg->max_value = value_rate;
170  pg->duration_period = period;
171  pg->frequency = frequency;
173 
174  switch (type) {
177  "Setting up constant preference generator master[%u] `%s' and slave [%u] `%s' max %u Bips\n",
178  dest->me->no, GNUNET_i2s (&dest->me->id),
179  dest->dest->no, GNUNET_i2s (&dest->dest->id),
180  base_value);
181  break;
184  "Setting up linear preference generator master[%u] `%s' and slave [%u] `%s' min %u Bips max %u Bips\n",
185  dest->me->no, GNUNET_i2s (&dest->me->id),
186  dest->dest->no, GNUNET_i2s (&dest->dest->id),
187  base_value, value_rate);
188  break;
191  "Setting up sinus preference generator master[%u] `%s' and slave [%u] `%s' baserate %u Bips, amplitude %u Bps\n",
192  dest->me->no, GNUNET_i2s (&dest->me->id),
193  dest->dest->no, GNUNET_i2s (&dest->dest->id),
194  base_value, value_rate);
195  break;
198  "Setting up random preference generator master[%u] `%s' and slave [%u] `%s' min %u Bips max %u Bps\n",
199  dest->me->no, GNUNET_i2s (&dest->me->id),
200  dest->dest->no, GNUNET_i2s (&dest->dest->id),
201  base_value, value_rate);
202  break;
203  default:
204  break;
205  }
206 
207  dest->pg = pg;
209  return pg;
210 }
struct GNUNET_TIME_Absolute time_start
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
struct GNUNET_TIME_Relative duration_period
struct PreferenceGenerator * pg
Handle for preference generator.
Definition: ats-testing.h:300
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
enum GNUNET_ATS_PreferenceKind kind
struct BenchmarkPartner * dest
Definition: ats-testing.h:258
int no
Unique identifier.
Definition: ats-testing.h:121
static void set_pref_task(void *cls)
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_now(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run as soon as possible.
Definition: scheduler.c:1273
static struct PreferenceGenerator * pg_head
struct GNUNET_SCHEDULER_Task * set_task
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_get(void)
Get the current time.
Definition: time.c:118
struct BenchmarkPeer * src
Definition: ats-testing.h:257
struct GNUNET_TIME_Relative frequency
#define GNUNET_log(kind,...)
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
static struct PreferenceGenerator * pg_tail
struct BenchmarkPeer * me
The peer itself this partner belongs to.
Definition: ats-testing.h:280
const char * GNUNET_i2s(const struct GNUNET_PeerIdentity *pid)
Convert a peer identity to a string (for printing debug messages).
struct BenchmarkPeer * dest
The partner peer.
Definition: ats-testing.h:285
struct GNUNET_PeerIdentity id
Peer ID.
Definition: ats-testing.h:131
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_ATS_TEST_generate_preferences_stop()

void GNUNET_ATS_TEST_generate_preferences_stop ( struct PreferenceGenerator pg)

Definition at line 214 of file ats-testing-preferences.c.

References PreferenceGenerator::dest, GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_SCHEDULER_cancel(), BenchmarkPartner::pg, and PreferenceGenerator::set_task.

Referenced by enforce_start_preference(), enforce_stop_preference(), and GNUNET_ATS_TEST_generate_preferences_stop_all().

215 {
217  pg->dest->pg = NULL;
218 
219  if (NULL != pg->set_task)
220  {
222  pg->set_task = NULL;
223  }
224 
225  GNUNET_free (pg);
226 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
struct PreferenceGenerator * pg
Handle for preference generator.
Definition: ats-testing.h:300
struct BenchmarkPartner * dest
Definition: ats-testing.h:258
static struct PreferenceGenerator * pg_head
struct GNUNET_SCHEDULER_Task * set_task
static struct PreferenceGenerator * pg_tail
#define GNUNET_free(ptr)
Wrapper around free.
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:965
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_ATS_TEST_generate_preferences_stop_all()

void GNUNET_ATS_TEST_generate_preferences_stop_all ( void  )

Stop all preferences generators.

Definition at line 233 of file ats-testing-preferences.c.

References GNUNET_ATS_TEST_generate_preferences_stop(), PreferenceGenerator::next, and pg_head.

Referenced by do_shutdown(), and experiment_done_cb().

234 {
235  struct PreferenceGenerator *cur;
236  struct PreferenceGenerator *next;
237  next = pg_head;
238  for (cur = next; NULL != cur; cur = next)
239  {
240  next = cur->next;
242  }
243 }
struct PreferenceGenerator * next
static struct PreferenceGenerator * pg_head
void GNUNET_ATS_TEST_generate_preferences_stop(struct PreferenceGenerator *pg)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_ATS_TEST_logging_start()

struct LoggingHandle* GNUNET_ATS_TEST_logging_start ( struct GNUNET_TIME_Relative  log_frequency,
const char *  testname,
struct BenchmarkPeer masters,
int  num_masters,
int  num_slaves,
int  verbose 
)

Start logging.

Parameters
log_frequencythe logging frequency
testnamethe testname
mastersthe master peers used for benchmarking
num_mastersthe number of master peers
num_slavesthe number of slave peers
verboseverbose logging
Returns
the logging handle or NULL on error

Definition at line 881 of file ats-testing-log.c.

References _, collect_log_task(), LoggingHandle::frequency, GNUNET_ERROR_TYPE_INFO, GNUNET_log, GNUNET_malloc, GNUNET_new, GNUNET_SCHEDULER_add_now(), GNUNET_TIME_absolute_get(), GNUNET_YES, l, LoggingHandle::log_task, LoggingHandle::lp, LoggingHandle::name, LoggingHandle::num_masters, LoggingHandle::num_slaves, LoggingPeer::peer, LoggingHandle::running, LoggingPeer::start, verbose, and LoggingHandle::verbose.

Referenced by topology_setup_done().

887 {
888  struct LoggingHandle *l;
889  int c_m;
890 
892  _("Start logging `%s'\n"), testname);
893 
894  l = GNUNET_new (struct LoggingHandle);
896  l->num_slaves = num_slaves;
897  l->name = testname;
898  l->frequency = log_frequency;
899  l->verbose = verbose;
900  l->lp = GNUNET_malloc (num_masters * sizeof (struct LoggingPeer));
901 
902  for (c_m = 0; c_m < num_masters; c_m ++)
903  {
904  l->lp[c_m].peer = &masters[c_m];
905  l->lp[c_m].start = GNUNET_TIME_absolute_get();
906  }
907 
908  /* Schedule logging task */
910  l->running = GNUNET_YES;
911 
912  return l;
913 }
const char * name
static void collect_log_task(void *cls)
struct BenchmarkPeer * peer
Peer.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
struct LoggingPeer * lp
Log structure of length num_peers.
#define _(String)
GNU gettext support macro.
Definition: platform.h:208
static struct LoggingHandle * l
static int verbose
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_now(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run as soon as possible.
Definition: scheduler.c:1273
struct GNUNET_TIME_Absolute start
Start time.
struct GNUNET_TIME_Relative frequency
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_get(void)
Get the current time.
Definition: time.c:118
Entry for a benchmark peer.
struct GNUNET_SCHEDULER_Task * log_task
Logging task.
#define GNUNET_log(kind,...)
int num_masters
Reference to perf_ats&#39; masters.
#define GNUNET_YES
Definition: gnunet_common.h:80
#define GNUNET_malloc(size)
Wrapper around malloc.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_ATS_TEST_logging_clean_up()

void GNUNET_ATS_TEST_logging_clean_up ( struct LoggingHandle l)

Stop logging.

Parameters
lthe logging handle

Stop logging.

Parameters
lthe logging handle

Definition at line 846 of file ats-testing-log.c.

References GNUNET_ATS_TEST_logging_stop(), GNUNET_CONTAINER_DLL_remove, GNUNET_free, GNUNET_YES, LoggingPeer::head, LoggingHandle::lp, LoggingHandle::num_masters, LoggingHandle::running, PeerLoggingTimestep::slaves_log, and LoggingPeer::tail.

Referenced by do_shutdown().

847 {
848  int c_m;
849  struct PeerLoggingTimestep *cur;
850 
851  if (GNUNET_YES == l->running)
853 
854  for (c_m = 0; c_m < l->num_masters; c_m++)
855  {
856  while (NULL != (cur = l->lp[c_m].head))
857  {
858  GNUNET_CONTAINER_DLL_remove (l->lp[c_m].head, l->lp[c_m].tail, cur);
859  GNUNET_free (cur->slaves_log);
860  GNUNET_free (cur);
861  }
862  }
863 
864  GNUNET_free (l->lp);
865  GNUNET_free (l);
866 }
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
struct PeerLoggingTimestep * head
DLL for logging entries: head.
struct PartnerLoggingTimestep * slaves_log
Logs for slaves.
struct LoggingPeer * lp
Log structure of length num_peers.
A single logging time step for a peer.
void GNUNET_ATS_TEST_logging_stop(struct LoggingHandle *l)
Stop logging.
struct PeerLoggingTimestep * tail
DLL for logging entries: tail.
int num_masters
Reference to perf_ats&#39; masters.
#define GNUNET_YES
Definition: gnunet_common.h:80
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_ATS_TEST_logging_stop()

void GNUNET_ATS_TEST_logging_stop ( struct LoggingHandle l)

Stop logging.

Parameters
lthe logging handle

Definition at line 824 of file ats-testing-log.c.

References _, GNUNET_ERROR_TYPE_INFO, GNUNET_log, GNUNET_NO, GNUNET_SCHEDULER_cancel(), GNUNET_YES, LoggingHandle::log_task, and LoggingHandle::running.

Referenced by do_shutdown(), experiment_done_cb(), and GNUNET_ATS_TEST_logging_clean_up().

825 {
826  if (GNUNET_YES!= l->running)
827  return;
828 
829  if (NULL != l->log_task)
830  {
832  l->log_task = NULL;
833  }
834  l->running = GNUNET_NO;
835 
837  _("Stop logging\n"));
838 }
#define GNUNET_NO
Definition: gnunet_common.h:81
#define _(String)
GNU gettext support macro.
Definition: platform.h:208
struct GNUNET_SCHEDULER_Task * log_task
Logging task.
#define GNUNET_log(kind,...)
#define GNUNET_YES
Definition: gnunet_common.h:80
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:965
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_ATS_TEST_logging_now()

void GNUNET_ATS_TEST_logging_now ( struct LoggingHandle l)

Log all data now.

Parameters
llogging handle to use

Definition at line 623 of file ats-testing-log.c.

References PartnerLoggingTimestep::app_rtt, PartnerLoggingTimestep::ats_delay, PartnerLoggingTimestep::ats_distance, PartnerLoggingTimestep::ats_network_type, PartnerLoggingTimestep::ats_utilization_in, PartnerLoggingTimestep::ats_utilization_out, PartnerLoggingTimestep::bandwidth_in, BenchmarkPartner::bandwidth_in, PartnerLoggingTimestep::bandwidth_out, BenchmarkPartner::bandwidth_out, BenchmarkPartner::bytes_received, BenchmarkPartner::bytes_sent, GNUNET_ATS_Properties::delay, BenchmarkPartner::dest, GNUNET_ATS_Properties::distance, GNUNET_CONTAINER_DLL_insert_tail, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_ERROR_TYPE_INFO, GNUNET_log, GNUNET_malloc, GNUNET_new, GNUNET_TIME_absolute_get(), GNUNET_TIME_absolute_get_difference(), GNUNET_TIME_UNIT_SECONDS, GNUNET_YES, LoggingPeer::head, LoggingHandle::lp, BenchmarkPartner::messages_received, BenchmarkPartner::messages_sent, BenchmarkPeer::no, LoggingHandle::num_masters, BenchmarkPeer::num_partners, p, BenchmarkPeer::partners, LoggingPeer::peer, PartnerLoggingTimestep::pref_bandwidth, BenchmarkPartner::pref_bandwidth, PartnerLoggingTimestep::pref_delay, BenchmarkPartner::pref_delay, PeerLoggingTimestep::prev, BenchmarkPartner::props, GNUNET_TIME_Relative::rel_value_us, LoggingHandle::running, GNUNET_ATS_Properties::scope, PartnerLoggingTimestep::slave, PeerLoggingTimestep::slaves_log, LoggingPeer::start, LoggingPeer::tail, PartnerLoggingTimestep::throughput_recv, PartnerLoggingTimestep::throughput_sent, PeerLoggingTimestep::timestamp, PartnerLoggingTimestep::total_app_rtt, BenchmarkPartner::total_app_rtt, PartnerLoggingTimestep::total_bytes_received, PeerLoggingTimestep::total_bytes_received, BenchmarkPeer::total_bytes_received, PartnerLoggingTimestep::total_bytes_sent, PeerLoggingTimestep::total_bytes_sent, BenchmarkPeer::total_bytes_sent, PartnerLoggingTimestep::total_messages_received, PeerLoggingTimestep::total_messages_received, BenchmarkPeer::total_messages_received, PartnerLoggingTimestep::total_messages_sent, PeerLoggingTimestep::total_messages_sent, BenchmarkPeer::total_messages_sent, PeerLoggingTimestep::total_throughput_recv, PeerLoggingTimestep::total_throughput_send, GNUNET_ATS_Properties::utilization_out, and LoggingHandle::verbose.

Referenced by collect_log_task().

624 {
625  struct LoggingPeer *bp;
626  struct PeerLoggingTimestep *mlt;
627  struct PeerLoggingTimestep *prev_log_mlt;
628  struct PartnerLoggingTimestep *slt;
629  struct PartnerLoggingTimestep *prev_log_slt;
630  struct BenchmarkPartner *p;
632  int c_s;
633  int c_m;
634  unsigned int app_rtt;
635  double mult;
636 
637  if (GNUNET_YES != l->running)
638  return;
639 
640  for (c_m = 0; c_m < l->num_masters; c_m++)
641  {
642  bp = &l->lp[c_m];
643  mlt = GNUNET_new (struct PeerLoggingTimestep);
644  GNUNET_CONTAINER_DLL_insert_tail(l->lp[c_m].head, l->lp[c_m].tail, mlt);
645  prev_log_mlt = mlt->prev;
646 
647  /* Collect data */
648  /* Current master state */
654 
655  /* Throughput */
656  if (NULL == prev_log_mlt)
657  {
658  /* Get difference to start */
660  }
661  else
662  {
663  /* Get difference to last timestep */
665  }
666 
667  /* Multiplication factor for throughput calculation */
668  mult = (double) GNUNET_TIME_UNIT_SECONDS.rel_value_us / (delta.rel_value_us);
669 
670  /* Total throughput */
671  if (NULL != prev_log_mlt)
672  {
673  if (mlt->total_bytes_sent - mlt->prev->total_bytes_sent > 0)
674  {
675  mlt->total_throughput_send = mult * (mlt->total_bytes_sent - mlt->prev->total_bytes_sent);
676  }
677  else
678  {
679  mlt->total_throughput_send = 0;
680  // mlt->total_throughput_send = prev_log_mlt->total_throughput_send; /* no msgs send */
681  }
682 
683  if (mlt->total_bytes_received - mlt->prev->total_bytes_received > 0)
684  {
686  }
687  else
688  {
689  mlt->total_throughput_recv = 0;
690  //mlt->total_throughput_recv = prev_log_mlt->total_throughput_recv; /* no msgs received */
691  }
692  }
693  else
694  {
695  mlt->total_throughput_send = mult * mlt->total_bytes_sent;
696  mlt->total_throughput_recv = mult * mlt->total_bytes_received;
697  }
698 
699  if (GNUNET_YES == l->verbose)
700  {
702  "Master[%u] delta: %llu us, bytes (sent/received): %u / %u; throughput send/recv: %u / %u\n",
703  c_m,
704  (unsigned long long) delta.rel_value_us,
705  mlt->total_bytes_sent,
708  mlt->total_throughput_recv);
709  }
710 
712  sizeof (struct PartnerLoggingTimestep));
713 
714  for (c_s = 0; c_s < bp->peer->num_partners; c_s++)
715  {
717  "Collect logging data master[%u] slave [%u]\n", c_m, c_s);
718 
719  p = &bp->peer->partners[c_s];
720  slt = &mlt->slaves_log[c_s];
721 
722  slt->slave = p->dest;
723  /* Bytes sent from master to this slave */
724  slt->total_bytes_sent = p->bytes_sent;
725  /* Messages sent from master to this slave */
727  /* Bytes master received from this slave */
729  /* Messages master received from this slave */
731  slt->total_app_rtt = p->total_app_rtt;
732  /* ats performance information */
733  slt->ats_delay = p->props.delay;
734  slt->ats_distance = p->props.distance;
735  slt->ats_network_type = p->props.scope;
738  slt->bandwidth_in = p->bandwidth_in;
739  slt->bandwidth_out = p->bandwidth_out;
740  slt->pref_bandwidth = p->pref_bandwidth;
741  slt->pref_delay = p->pref_delay;
742 
743  /* Total application level rtt */
744  if (NULL == prev_log_mlt)
745  {
746  if (0 != slt->total_messages_sent)
747  app_rtt = slt->total_app_rtt / slt->total_messages_sent;
748  else
749  app_rtt = 0;
750  }
751  else
752  {
753  prev_log_slt = &prev_log_mlt->slaves_log[c_s];
754  if ((slt->total_messages_sent - prev_log_slt->total_messages_sent) > 0)
755  app_rtt = (slt->total_app_rtt - prev_log_slt->total_app_rtt) /
756  (slt->total_messages_sent - prev_log_slt->total_messages_sent);
757  else
758  {
759  app_rtt = prev_log_slt->app_rtt; /* No messages were */
760  }
761  }
762  slt->app_rtt = app_rtt;
763 
764  /* Partner throughput */
765  if (NULL != prev_log_mlt)
766  {
767  prev_log_slt = &prev_log_mlt->slaves_log[c_s];
768  if (slt->total_bytes_sent > prev_log_slt->total_bytes_sent)
769  slt->throughput_sent = mult * (slt->total_bytes_sent - prev_log_slt->total_bytes_sent);
770  else
771  slt->throughput_sent = 0;
772 
773  if (slt->total_bytes_received > prev_log_slt->total_bytes_received)
774  slt->throughput_recv = mult *
775  (slt->total_bytes_received - prev_log_slt->total_bytes_received);
776  else
777  slt->throughput_recv = 0;
778  }
779  else
780  {
781  slt->throughput_sent = mult * slt->total_bytes_sent;
782  slt->throughput_recv = mult * slt->total_bytes_received;
783  }
784 
785  if (GNUNET_YES == l->verbose)
786  {
788  "Master [%u] -> Slave [%u]: delta: %llu us, bytes (sent/received): %u / %u; throughput send/recv: %u / %u\n",
789  c_m, c_s,
790  (unsigned long long) delta.rel_value_us,
791  mlt->total_bytes_sent,
793  slt->throughput_sent,
794  slt->throughput_recv);
795  }
796  else
798  "Master [%u]: slave [%u]\n",
799  bp->peer->no, p->dest->no);
800  }
801  }
802 }
unsigned int total_bytes_sent
Total number of bytes this peer has sent.
unsigned int total_bytes_sent
Total number of bytes this peer has sent.
Definition: ats-testing.h:217
unsigned int messages_sent
Number of messages sent to this partner.
Definition: ats-testing.h:315
unsigned int total_bytes_received
Total number of bytes this peer has received.
Definition: ats-testing.h:227
A single logging time step for a partner.
uint64_t rel_value_us
The actual value.
static struct GNUNET_TIME_Relative delta
Definition: speedup.c:35
struct PeerLoggingTimestep * head
DLL for logging entries: head.
unsigned int throughput_recv
Total inbound throughput for master in Bytes / s.
unsigned int total_messages_received
Total number of messages this peer has received.
#define GNUNET_TIME_UNIT_SECONDS
One second.
double pref_bandwidth
Current preference values for bandwidth.
Definition: ats-testing.h:350
struct BenchmarkPartner * partners
Array of partners with num_slaves entries (if master) or num_master entries (if slave) ...
Definition: ats-testing.h:191
unsigned int total_messages_received
Total number of messages this peer has received.
Definition: ats-testing.h:222
struct PartnerLoggingTimestep * slaves_log
Logs for slaves.
enum GNUNET_NetworkType ats_network_type
struct BenchmarkPeer * slave
Peer.
unsigned int bytes_received
Number of bytes received from this partner.
Definition: ats-testing.h:330
struct BenchmarkPeer * peer
Peer.
struct PeerLoggingTimestep * prev
Prev in DLL.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
struct LoggingPeer * lp
Log structure of length num_peers.
unsigned int total_messages_sent
Total number of messages this peer has sent.
Definition: ats-testing.h:212
unsigned int total_bytes_sent
Total number of bytes this peer has sent.
A single logging time step for a peer.
unsigned int total_messages_sent
Total number of messages this peer has sent.
int num_partners
Number of partners.
Definition: ats-testing.h:196
int no
Unique identifier.
Definition: ats-testing.h:121
static struct GNUNET_OS_Process * p
Helper process we started.
Definition: gnunet-qr.c:59
unsigned int total_app_rtt
Accumulated RTT for all messages.
Definition: ats-testing.h:310
uint32_t bandwidth_in
Bandwidth assigned inbound.
Definition: ats-testing.h:340
double pref_delay
Current preference values for delay.
Definition: ats-testing.h:355
unsigned int total_app_rtt
Accumulated RTT for all messages.
Information about a benchmarking partner.
Definition: ats-testing.h:275
struct GNUNET_TIME_Relative delay
Delay.
unsigned int messages_received
Number of messages received from this partner.
Definition: ats-testing.h:325
uint32_t bandwidth_out
Bandwidth assigned outbound.
Definition: ats-testing.h:345
struct GNUNET_TIME_Absolute start
Start time.
unsigned int app_rtt
Current application level delay.
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_get(void)
Get the current time.
Definition: time.c:118
Entry for a benchmark peer.
unsigned int total_messages_received
Total number of messages this peer has received.
unsigned int throughput_sent
Total outbound throughput for master in Bytes / s.
unsigned int total_throughput_send
Total outbound throughput for master in Bytes / s.
#define GNUNET_CONTAINER_DLL_insert_tail(head, tail, element)
Insert an element at the tail of a DLL.
struct GNUNET_TIME_Relative ats_delay
enum GNUNET_NetworkType scope
Which network scope does the respective address belong to? This property does not change...
struct GNUNET_TIME_Absolute timestamp
Logging timestamp.
unsigned int bytes_sent
Number of bytes sent to this partner.
Definition: ats-testing.h:320
unsigned int total_messages_sent
Total number of messages this peer has sent.
struct PeerLoggingTimestep * tail
DLL for logging entries: tail.
#define GNUNET_log(kind,...)
unsigned int total_throughput_recv
Total inbound throughput for master in Bytes / s.
int num_masters
Reference to perf_ats&#39; masters.
#define GNUNET_YES
Definition: gnunet_common.h:80
struct GNUNET_TIME_Relative GNUNET_TIME_absolute_get_difference(struct GNUNET_TIME_Absolute start, struct GNUNET_TIME_Absolute end)
Compute the time difference between the given start and end times.
Definition: time.c:353
struct GNUNET_ATS_Properties props
Current ATS properties.
Definition: ats-testing.h:335
unsigned int total_bytes_received
Total number of bytes this peer has received.
unsigned int distance
Distance on network layer (required for distance-vector routing) in hops.
struct BenchmarkPeer * dest
The partner peer.
Definition: ats-testing.h:285
#define GNUNET_malloc(size)
Wrapper around malloc.
unsigned int total_bytes_received
Total number of bytes this peer has received.
Time for relative time used by GNUnet, in microseconds.
uint32_t utilization_out
Actual traffic on this connection from this peer to the other peer.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_ATS_TEST_logging_write_to_file()

void GNUNET_ATS_TEST_logging_write_to_file ( struct LoggingHandle l,
const char *  test_name,
int  plots 
)

Write logging data to file.

Parameters
llogging handle to use
test_namename of the current test
plotscreate gnuplots: GNUNET_YES or GNUNET_NO

Definition at line 421 of file ats-testing-log.c.

References GNUNET_TIME_Absolute::abs_value_us, PartnerLoggingTimestep::app_rtt, PartnerLoggingTimestep::ats_delay, PartnerLoggingTimestep::ats_distance, PartnerLoggingTimestep::ats_network_type, PartnerLoggingTimestep::ats_utilization_in, PartnerLoggingTimestep::ats_utilization_out, PartnerLoggingTimestep::bandwidth_in, PartnerLoggingTimestep::bandwidth_out, data, removetrailingwhitespace::f, GNUNET_asprintf(), GNUNET_break, GNUNET_DISK_file_close(), GNUNET_DISK_file_open(), GNUNET_DISK_file_write(), GNUNET_DISK_OPEN_CREATE, GNUNET_DISK_OPEN_WRITE, GNUNET_DISK_PERM_USER_READ, GNUNET_DISK_PERM_USER_WRITE, GNUNET_ERROR_TYPE_ERROR, GNUNET_ERROR_TYPE_INFO, GNUNET_free, GNUNET_log, GNUNET_log_strerror_file, GNUNET_OK, GNUNET_SYSERR, GNUNET_TIME_absolute_get(), GNUNET_TIME_absolute_get_difference(), GNUNET_YES, LoggingPeer::head, LoggingHandle::lp, LoggingHandle::name, PeerLoggingTimestep::next, BenchmarkPeer::no, LoggingHandle::num_masters, BenchmarkPeer::num_partners, LoggingHandle::num_slaves, LoggingPeer::peer, PartnerLoggingTimestep::pref_bandwidth, PartnerLoggingTimestep::pref_delay, GNUNET_TIME_Relative::rel_value_us, PartnerLoggingTimestep::slave, PeerLoggingTimestep::slaves_log, LoggingPeer::start, PartnerLoggingTimestep::throughput_recv, PartnerLoggingTimestep::throughput_sent, PeerLoggingTimestep::timestamp, PartnerLoggingTimestep::total_bytes_received, PeerLoggingTimestep::total_bytes_received, PartnerLoggingTimestep::total_bytes_sent, PeerLoggingTimestep::total_bytes_sent, PartnerLoggingTimestep::total_messages_received, PeerLoggingTimestep::total_messages_received, PartnerLoggingTimestep::total_messages_sent, PeerLoggingTimestep::total_messages_sent, PeerLoggingTimestep::total_throughput_recv, PeerLoggingTimestep::total_throughput_send, LoggingHandle::verbose, write_bw_gnuplot_script(), write_rtt_gnuplot_script(), and write_throughput_gnuplot_script().

Referenced by experiment_done_cb().

424 {
425  struct GNUNET_DISK_FileHandle *f[l->num_slaves];
426  struct GNUNET_DISK_FileHandle *f_m;
427  const char *tmp_exp_name;
428  char *filename_master;
429  char *filename_slaves[l->num_slaves];
430  char *data;
431  struct PeerLoggingTimestep *cur_lt;
432  struct PartnerLoggingTimestep *plt;
433  struct GNUNET_TIME_Absolute timestamp;
434  int c_m;
435  int c_s;
436 
437 
438  timestamp = GNUNET_TIME_absolute_get();
439 
440  tmp_exp_name = experiment_name;
441  for (c_m = 0; c_m < l->num_masters; c_m++)
442  {
443  GNUNET_asprintf (&filename_master, "%s_%llu_master%u_%s",
444  experiment_name, timestamp.abs_value_us, c_m, l->name);
445  fprintf (stderr, "Writing data for master %u to file `%s'\n",
446  c_m,filename_master);
447 
448  f_m = GNUNET_DISK_file_open (filename_master,
451  if (NULL == f_m)
452  {
453  GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot open log file `%s'\n", filename_master);
454  GNUNET_free (filename_master);
455  return;
456  }
457 
458  GNUNET_asprintf (&data, "# master %u; experiment : %s\n"
459  "timestamp; timestamp delta; #messages sent; #bytes sent; #throughput sent; #messages received; #bytes received; #throughput received; \n" ,
460  c_m, experiment_name);
461  if (GNUNET_SYSERR == GNUNET_DISK_file_write(f_m, data, strlen(data)))
463  "Cannot write data to log file `%s'\n",filename_master);
464  GNUNET_free (data);
465 
466  for (c_s = 0; c_s < l->lp[c_m].peer->num_partners; c_s++)
467  {
468  GNUNET_asprintf (&filename_slaves[c_s], "%s_%llu_master%u_slave_%u_%s",
469  tmp_exp_name, timestamp.abs_value_us, c_m, c_s, l->name);
470 
471  fprintf (stderr, "Writing data for master %u slave %u to file `%s'\n",
472  c_m, c_s, filename_slaves[c_s]);
473 
474  f[c_s] = GNUNET_DISK_file_open (filename_slaves[c_s],
477  if (NULL == f[c_s])
478  {
479  GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Cannot open log file `%s'\n", filename_slaves[c_s]);
480  GNUNET_free (filename_slaves[c_s]);
482  GNUNET_free (filename_master);
483  return;
484  }
485 
486  /* Header */
487  GNUNET_asprintf (&data, "# master %u; slave %u ; experiment : %s\n"
488  "timestamp; timestamp delta; #messages sent; #bytes sent; #throughput sent; #messages received; #bytes received; #throughput received; " \
489  "rtt; bw in; bw out; ats_cost_lan; ats_cost_wlan; ats_delay; ats_distance; ats_network_type; ats_utilization_up ;ats_utilization_down;" \
490  "pref bandwidth; pref delay\n",
491  c_m, c_s, experiment_name);
492  if (GNUNET_SYSERR == GNUNET_DISK_file_write(f[c_s], data, strlen(data)))
494  "Cannot write data to log file `%s'\n",filename_slaves[c_s]);
495  GNUNET_free (data);
496  }
497 
498  for (cur_lt = l->lp[c_m].head; NULL != cur_lt; cur_lt = cur_lt->next)
499  {
500  if (l->verbose)
501  fprintf (stderr,
502  "Master [%u]: timestamp %llu %llu ; %u %u %u ; %u %u %u\n",
503  l->lp[c_m].peer->no,
504  (long long unsigned int) cur_lt->timestamp.abs_value_us,
505  (long long unsigned int) GNUNET_TIME_absolute_get_difference(l->lp[c_m].start,
506  cur_lt->timestamp).rel_value_us / 1000,
507  cur_lt->total_messages_sent,
508  cur_lt->total_bytes_sent,
509  cur_lt->total_throughput_send,
510  cur_lt->total_messages_received,
511  cur_lt->total_bytes_received,
512  cur_lt->total_throughput_recv);
513 
514  /* Assembling master string */
515  GNUNET_asprintf (&data, "%llu;%llu;%u;%u;%u;%u;%u;%u;\n",
516  (long long unsigned int) cur_lt->timestamp.abs_value_us,
517  (long long unsigned int) GNUNET_TIME_absolute_get_difference(l->lp[c_m].start,
518  cur_lt->timestamp).rel_value_us / 1000,
519  cur_lt->total_messages_sent,
520  cur_lt->total_bytes_sent,
521  cur_lt->total_throughput_send,
522  cur_lt->total_messages_received,
523  cur_lt->total_bytes_received,
524  cur_lt->total_throughput_recv);
525 
526  if (GNUNET_SYSERR == GNUNET_DISK_file_write(f_m, data, strlen(data)))
528  "Cannot write data to master file %u\n", c_m);
529  GNUNET_free (data);
530 
531 
532  for (c_s = 0; c_s < l->lp[c_m].peer->num_partners; c_s++)
533  {
534  plt = &cur_lt->slaves_log[c_s];
535  /* Log partners */
536 
537  /* Assembling slave string */
538  GNUNET_asprintf(&data,
539  "%llu;%llu;%u;%u;%u;%u;%u;%u;%.3f;%u;%u;%u;%u;%u;%u;%u;%.3f;%.3f\n",
540  (long long unsigned int) cur_lt->timestamp.abs_value_us,
541  (long long unsigned int) GNUNET_TIME_absolute_get_difference(l->lp[c_m].start,
542  cur_lt->timestamp).rel_value_us / 1000,
543  plt->total_messages_sent,
544  plt->total_bytes_sent,
545  plt->throughput_sent,
548  plt->throughput_recv,
549  (double) plt->app_rtt / 1000,
550  plt->bandwidth_in,
551  plt->bandwidth_out,
552  plt->ats_delay,
553  plt->ats_distance,
554  plt->ats_network_type,
555  plt->ats_utilization_out,
556  plt->ats_utilization_in,
557  plt->pref_bandwidth,
558  plt->pref_delay);
559 
560  if (l->verbose)
561  fprintf (stderr,
562  "\t Slave [%u]: %u %u %u ; %u %u %u rtt %u delay %llu bw_in %u bw_out %u \n",
563  plt->slave->no,
564  plt->total_messages_sent,
565  plt->total_bytes_sent,
566  plt->throughput_sent,
569  plt->throughput_recv,
570  plt->app_rtt,
571  (long long unsigned int) plt->ats_delay.rel_value_us,
572  plt->bandwidth_in,
573  plt->bandwidth_out);
574 
575  if (GNUNET_SYSERR == GNUNET_DISK_file_write(f[c_s], data, strlen(data)))
577  "Cannot write data to log file `%s'\n", filename_slaves[c_s]);
578  GNUNET_free (data);
579 
580  }
581  }
582 
583  for (c_s = 0; c_s < l->lp[c_m].peer->num_partners; c_s++)
584  {
585  if (GNUNET_SYSERR == GNUNET_DISK_file_close(f[c_s]))
586  {
588  "Cannot close log file for master[%u] slave[%u]\n", c_m, c_s);
589  continue;
590  }
592  "Data file successfully written to log file for `%s'\n",
593  filename_slaves[c_s]);
594  }
595 
597  {
599  "close",
600  filename_master);
601  GNUNET_free (filename_master);
602  return;
603  }
605  "Data file successfully written to log file for master `%s'\n", filename_master);
606 
607  if (GNUNET_YES == plots)
608  {
609  write_throughput_gnuplot_script (filename_master, &l->lp[c_m], filename_slaves, l->num_slaves);
610  write_rtt_gnuplot_script (filename_master, &l->lp[c_m], filename_slaves, l->num_slaves);
611  write_bw_gnuplot_script (filename_master, &l->lp[c_m], filename_slaves, l->num_slaves);
612  }
613  }
614  GNUNET_free (filename_master);
615 }
unsigned int total_bytes_sent
Total number of bytes this peer has sent.
static void write_rtt_gnuplot_script(char *fn, struct LoggingPeer *lp, char **fs, int slaves)
Create file if it doesn&#39;t exist.
A single logging time step for a partner.
const char * name
int GNUNET_DISK_file_close(struct GNUNET_DISK_FileHandle *h)
Close an open file.
Definition: disk.c:1817
uint64_t rel_value_us
The actual value.
struct PeerLoggingTimestep * head
DLL for logging entries: head.
unsigned int throughput_recv
Total inbound throughput for master in Bytes / s.
unsigned int total_messages_received
Total number of messages this peer has received.
static void write_bw_gnuplot_script(char *fn, struct LoggingPeer *lp, char **fs, int slaves)
struct PartnerLoggingTimestep * slaves_log
Logs for slaves.
enum GNUNET_NetworkType ats_network_type
struct BenchmarkPeer * slave
Peer.
struct BenchmarkPeer * peer
Peer.
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:78
struct LoggingPeer * lp
Log structure of length num_peers.
uint64_t abs_value_us
The actual value.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
unsigned int total_bytes_sent
Total number of bytes this peer has sent.
A single logging time step for a peer.
int GNUNET_asprintf(char **buf, const char *format,...)
Like asprintf, just portable.
unsigned int total_messages_sent
Total number of messages this peer has sent.
int num_partners
Number of partners.
Definition: ats-testing.h:196
int no
Unique identifier.
Definition: ats-testing.h:121
#define GNUNET_log_strerror_file(level, cmd, filename)
Log an error message at log-level &#39;level&#39; that indicates a failure of the command &#39;cmd&#39; with the mess...
ssize_t GNUNET_DISK_file_write(const struct GNUNET_DISK_FileHandle *h, const void *buffer, size_t n)
Write a buffer to a file.
Definition: disk.c:1049
struct GNUNET_TIME_Absolute start
Start time.
unsigned int app_rtt
Current application level delay.
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_get(void)
Get the current time.
Definition: time.c:118
unsigned int total_messages_received
Total number of messages this peer has received.
#define GNUNET_SYSERR
Definition: gnunet_common.h:79
unsigned int throughput_sent
Total outbound throughput for master in Bytes / s.
Open the file for writing.
unsigned int total_throughput_send
Total outbound throughput for master in Bytes / s.
struct GNUNET_TIME_Relative ats_delay
struct GNUNET_TIME_Absolute timestamp
Logging timestamp.
unsigned int total_messages_sent
Total number of messages this peer has sent.
#define GNUNET_log(kind,...)
unsigned int total_throughput_recv
Total inbound throughput for master in Bytes / s.
struct PeerLoggingTimestep * next
Next in DLL.
int num_masters
Reference to perf_ats&#39; masters.
Time for absolute times used by GNUnet, in microseconds.
#define GNUNET_YES
Definition: gnunet_common.h:80
struct GNUNET_TIME_Relative GNUNET_TIME_absolute_get_difference(struct GNUNET_TIME_Absolute start, struct GNUNET_TIME_Absolute end)
Compute the time difference between the given start and end times.
Definition: time.c:353
unsigned int total_bytes_received
Total number of bytes this peer has received.
uint32_t data
The data value.
static void write_throughput_gnuplot_script(char *fn, struct LoggingPeer *lp, char **fs, int slaves)
struct GNUNET_DISK_FileHandle * GNUNET_DISK_file_open(const char *fn, enum GNUNET_DISK_OpenFlags flags, enum GNUNET_DISK_AccessPermissions perm)
Open a file.
Definition: disk.c:1673
Handle used to access files (and pipes).
unsigned int total_bytes_received
Total number of bytes this peer has received.
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_ATS_TEST_get_peer()

struct BenchmarkPeer* GNUNET_ATS_TEST_get_peer ( int  src)

Topology related functions.

Definition at line 890 of file ats-testing.c.

References GNUNET_ATS_TEST_Topology::mps, and GNUNET_ATS_TEST_Topology::num_masters.

Referenced by enforce_start_preference(), and enforce_start_send().

891 {
892  if (src > top->num_masters)
893  return NULL;
894  return &top->mps[src];
895 }
struct GNUNET_ATS_TEST_Topology * top
Definition: ats-testing.c:53
struct BenchmarkPeer * mps
Array of master peers.
Definition: ats-testing.h:436
unsigned int num_masters
Number master peers.
Definition: ats-testing.h:431
Here is the caller graph for this function:

◆ GNUNET_ATS_TEST_get_partner()

struct BenchmarkPartner* GNUNET_ATS_TEST_get_partner ( int  src,
int  dest 
)

Definition at line 899 of file ats-testing.c.

References BenchmarkPartner::dest, GNUNET_ATS_TEST_Topology::mps, GNUNET_ATS_TEST_Topology::num_masters, GNUNET_ATS_TEST_Topology::num_slaves, and BenchmarkPeer::partners.

Referenced by enforce_start_preference(), enforce_start_send(), enforce_stop_preference(), and enforce_stop_send().

901 {
902  if (src > top->num_masters)
903  return NULL;
904  if (dest > top->num_slaves)
905  return NULL;
906  return &top->mps[src].partners[dest];
907 }
struct BenchmarkPartner * partners
Array of partners with num_slaves entries (if master) or num_master entries (if slave) ...
Definition: ats-testing.h:191
struct GNUNET_ATS_TEST_Topology * top
Definition: ats-testing.c:53
unsigned int num_slaves
Number slave peers.
Definition: ats-testing.h:441
struct BenchmarkPeer * mps
Array of master peers.
Definition: ats-testing.h:436
unsigned int num_masters
Number master peers.
Definition: ats-testing.h:431
Here is the caller graph for this function:

◆ GNUNET_ATS_TEST_create_topology()

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_ATS_AddressInformationCallback  log_request_cb 
)

Create a topology for ats testing.

Parameters
nametest name
cfg_fileconfiguration file to use for the peers
num_slavesnumber of slaves
num_mastersnumber of masters
test_coreconnect to CORE service (GNUNET_YES) or transport (GNUNET_NO)
done_cbfunction to call when topology is setup
done_cb_clscls for callback
log_request_cbcallback to call when logging is required
nametest name
cfg_fileconfiguration file to use for the peers
num_slavesnumber of slaves
num_mastersnumber of masters
test_coreconnect to CORE service (GNUNET_YES) or transport (GNUNET_NO)
done_cbfunction to call when topology is setup
done_cb_clscls for callback
log_request_cbcallback to call when logging is required

Definition at line 923 of file ats-testing.c.

References GNUNET_ATS_TEST_Topology::ats_perf_cb, controller_event_cb(), GNUNET_ATS_TEST_Topology::done_cb, GNUNET_ATS_TEST_Topology::done_cb_cls, event_mask, GNUNET_new, GNUNET_new_array, GNUNET_TESTBED_ET_CONNECT, GNUNET_TESTBED_ET_OPERATION_FINISHED, GNUNET_TESTBED_test_run(), main_run(), GNUNET_ATS_TEST_Topology::mps, GNUNET_ATS_TEST_Topology::num_masters, GNUNET_ATS_TEST_Topology::num_slaves, GNUNET_ATS_TEST_Topology::sps, and GNUNET_ATS_TEST_Topology::test_core.

Referenced by main().

930 {
932  top->num_masters = num_masters;
933  top->num_slaves = num_slaves;
934  top->done_cb = done_cb;
935  top->done_cb_cls = done_cb_cls;
936  top->test_core = test_core;
937  top->ats_perf_cb = log_request_cb;
938  top->mps = GNUNET_new_array (num_masters,
939  struct BenchmarkPeer);
940  top->sps = GNUNET_new_array (num_slaves,
941  struct BenchmarkPeer);
942 
943  /* Start topology */
944  uint64_t event_mask;
945  event_mask = 0;
946  event_mask |= (1LL << GNUNET_TESTBED_ET_CONNECT);
947  event_mask |= (1LL << GNUNET_TESTBED_ET_OPERATION_FINISHED);
949  cfg_file,
950  num_slaves + num_masters,
951  event_mask,
952  &controller_event_cb, NULL,
953  &main_run, NULL);
954 }
int test_core
Test core (GNUNET_YES) or transport (GNUNET_NO)
Definition: ats-testing.h:406
int GNUNET_TESTBED_test_run(const char *testname, const char *cfg_filename, unsigned int num_peers, uint64_t event_mask, GNUNET_TESTBED_ControllerCallback cc, void *cc_cls, GNUNET_TESTBED_TestMaster test_master, void *test_master_cls)
Convenience method for running a "simple" test on the local system with a single call from &#39;main&#39;...
struct GNUNET_ATS_TEST_Topology * top
Definition: ats-testing.c:53
#define GNUNET_new(type)
Allocate a struct or union of the given type.
static void main_run(void *cls, struct GNUNET_TESTBED_RunHandle *h, unsigned int num_peers, struct GNUNET_TESTBED_Peer **peers_, unsigned int links_succeeded, unsigned int links_failed)
Signature of a main function for a testcase.
Definition: ats-testing.c:784
Information we track for a peer in the testbed.
Definition: ats-testing.h:111
A requested testbed operation has been completed.
#define GNUNET_new_array(n, type)
Allocate a size n array with structs or unions of the given type.
static const char * cfg_file
Configuration filename.
uint64_t event_mask
Global event mask for all testbed events.
unsigned int num_slaves
Number slave peers.
Definition: ats-testing.h:441
const char * name
struct BenchmarkPeer * sps
Array of slave peers.
Definition: ats-testing.h:446
struct BenchmarkPeer * mps
Array of master peers.
Definition: ats-testing.h:436
A connection between two peers was established.
GNUNET_ATS_AddressInformationCallback ats_perf_cb
Definition: ats-testing.h:465
static void controller_event_cb(void *cls, const struct GNUNET_TESTBED_EventInformation *event)
Controller event callback.
Definition: ats-testing.c:873
GNUNET_ATS_TEST_TopologySetupDoneCallback done_cb
Definition: ats-testing.h:463
unsigned int num_masters
Number master peers.
Definition: ats-testing.h:431
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GNUNET_ATS_TEST_shutdown_topology()

void GNUNET_ATS_TEST_shutdown_topology ( void  )

Shutdown topology.

Definition at line 961 of file ats-testing.c.

References GNUNET_SCHEDULER_shutdown().

Referenced by do_shutdown().

962 {
963  if (NULL == top)
964  return;
966 }
struct GNUNET_ATS_TEST_Topology * top
Definition: ats-testing.c:53
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
Definition: scheduler.c:524
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ cfg

Handle to our configuration.

Handle to our configuration.

Definition at line 51 of file ats-testing.c.