GNUnet  0.11.x
Functions | Variables
ats-testing-traffic.c File Reference

ats benchmark: traffic generator More...

#include "platform.h"
#include "gnunet_util_lib.h"
#include "ats-testing.h"
Include dependency graph for ats-testing-traffic.c:

Go to the source code of this file.

Functions

static struct GNUNET_TIME_Relative get_delay (struct TrafficGenerator *tg)
 
static void update_ping_data (void *cls)
 
static void comm_schedule_send (void *cls)
 
static void update_pong_data (void *cls)
 
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 ()
 Stop all traffic generators. More...
 

Variables

static struct TrafficGeneratortg_head
 
static struct TrafficGeneratortg_tail
 
struct GNUNET_ATS_TEST_Topologytop
 

Detailed Description

ats benchmark: traffic generator

Author
Christian Grothoff
Matthias Wachs

Definition in file ats-testing-traffic.c.

Function Documentation

◆ get_delay()

static struct GNUNET_TIME_Relative get_delay ( struct TrafficGenerator tg)
static

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

References delay, GNUNET_ATS_TEST_TG_CONSTANT, GNUNET_ATS_TEST_TG_LINEAR, GNUNET_ATS_TEST_TG_RANDOM, GNUNET_ATS_TEST_TG_SINUS, GNUNET_break, GNUNET_CRYPTO_QUALITY_WEAK, GNUNET_CRYPTO_random_u32(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_TIME_absolute_get_duration(), GNUNET_TIME_UNIT_SECONDS, GNUNET_TIME_UNIT_ZERO, GNUNET_TIME_Relative::rel_value_us, and TEST_MESSAGE_SIZE.

Referenced by update_ping_data().

37 {
39  struct GNUNET_TIME_Relative time_delta;
40  long long int cur_rate;
41  long long int delta_rate;
42 
43  delay.rel_value_us = 0;
44 
45  /* Calculate the current transmission rate based on the type of traffic */
46  switch (tg->type)
47  {
49  if (UINT32_MAX == tg->base_rate)
50  return GNUNET_TIME_UNIT_ZERO;
51  cur_rate = tg->base_rate;
52  break;
53 
56  /* Calculate point of time in the current period */
57  time_delta.rel_value_us = time_delta.rel_value_us
59  delta_rate = ((double) time_delta.rel_value_us
61  * (tg->max_rate - tg->base_rate);
62  if ((tg->max_rate < tg->base_rate) && ((tg->max_rate - tg->base_rate) >
63  tg->base_rate))
64  {
65  /* This will cause an underflow */
66  GNUNET_break (0);
67  }
68  cur_rate = tg->base_rate + delta_rate;
69  break;
70 
72  cur_rate = tg->base_rate + GNUNET_CRYPTO_random_u32 (
74  tg->max_rate
75  - tg->base_rate);
76  break;
77 
80  /* Calculate point of time in the current period */
81  time_delta.rel_value_us = time_delta.rel_value_us
83  if ((tg->max_rate - tg->base_rate) > tg->base_rate)
84  {
85  /* This will cause an underflow for second half of sinus period,
86  * will be detected in general when experiments are loaded */
87  GNUNET_break (0);
88  }
89  delta_rate = (tg->max_rate - tg->base_rate)
90  * sin ((2 * M_PI)
91  / ((double) tg->duration_period.rel_value_us)
92  * time_delta.rel_value_us);
93  cur_rate = tg->base_rate + delta_rate;
94  break;
95 
96  default:
97  return delay;
98  break;
99  }
100 
101  if (cur_rate < 0)
102  {
103  cur_rate = 1;
104  }
105  /* Calculate the delay for the next message based on the current delay */
107  * TEST_MESSAGE_SIZE / cur_rate;
108 
110  "Current rate is %lld, calculated delay is %llu\n",
111  cur_rate,
112  (unsigned long long) delay.rel_value_us);
113  return delay;
114 }
uint64_t rel_value_us
The actual value.
uint32_t GNUNET_CRYPTO_random_u32(enum GNUNET_CRYPTO_Quality mode, uint32_t i)
Produce a random value.
long int max_rate
Definition: ats-testing.h:241
#define GNUNET_TIME_UNIT_SECONDS
One second.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
struct GNUNET_TIME_Absolute time_start
Definition: ats-testing.h:246
enum GeneratorType type
Definition: ats-testing.h:235
static struct GNUNET_TIME_Relative delay
When should dkg communication start?
#define GNUNET_TIME_UNIT_ZERO
Relative time zero.
long int base_rate
Definition: ats-testing.h:240
struct GNUNET_TIME_Relative GNUNET_TIME_absolute_get_duration(struct GNUNET_TIME_Absolute whence)
Get the duration of an operation as the difference of the current time and the given start time "henc...
Definition: time.c:375
#define GNUNET_log(kind,...)
struct GNUNET_TIME_Relative duration_period
Definition: ats-testing.h:242
#define TEST_MESSAGE_SIZE
Size of test messages.
Definition: ats-testing.h:48
No good quality of the operation is needed (i.e., random numbers can be pseudo-random).
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:

◆ update_ping_data()

static void update_ping_data ( void *  cls)
static

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

References BenchmarkPartner::bytes_sent, get_delay(), GNUNET_break, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_STRINGS_relative_time_to_string(), GNUNET_TIME_absolute_add(), GNUNET_TIME_absolute_get(), GNUNET_YES, BenchmarkPartner::me, BenchmarkPartner::messages_sent, TrafficGenerator::next_ping_transmission, p, TEST_MESSAGE_SIZE, BenchmarkPartner::tg, BenchmarkPeer::total_bytes_sent, and BenchmarkPeer::total_messages_sent.

Referenced by comm_schedule_send().

119 {
120  struct BenchmarkPartner *p = cls;
122 
123  p->messages_sent++;
125  p->me->total_messages_sent++;
127 
128  if (NULL == p->tg)
129  {
130  GNUNET_break (0);
131  return;
132  }
133  delay = get_delay (p->tg);
135  "Delay for next transmission %s\n",
137  GNUNET_YES));
140  delay);
141 }
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
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_add(struct GNUNET_TIME_Absolute start, struct GNUNET_TIME_Relative duration)
Add a given relative duration to the given start time.
Definition: time.c:395
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
unsigned int total_messages_sent
Total number of messages this peer has sent.
Definition: ats-testing.h:212
struct TrafficGenerator * tg
Handle for traffic generator.
Definition: ats-testing.h:295
static struct GNUNET_OS_Process * p
Helper process we started.
Definition: gnunet-qr.c:59
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:687
Information about a benchmarking partner.
Definition: ats-testing.h:275
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_get(void)
Get the current time.
Definition: time.c:118
static struct GNUNET_TIME_Relative delay
When should dkg communication start?
unsigned int bytes_sent
Number of bytes sent to this partner.
Definition: ats-testing.h:320
#define GNUNET_log(kind,...)
#define GNUNET_YES
Definition: gnunet_common.h:77
static struct GNUNET_TIME_Relative get_delay(struct TrafficGenerator *tg)
struct BenchmarkPeer * me
The peer itself this partner belongs to.
Definition: ats-testing.h:280
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:

◆ comm_schedule_send()

static void comm_schedule_send ( void *  cls)
static

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

References BenchmarkPartner::dest, env, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_MQ_msg, GNUNET_MQ_notify_sent(), GNUNET_MQ_send(), GNUNET_TIME_absolute_get(), BenchmarkPartner::last_message_sent, BenchmarkPartner::me, BenchmarkPartner::mq, msg, BenchmarkPeer::no, p, TestMessage::padding, TrafficGenerator::send_task, TEST_MESSAGE_TYPE_PING, BenchmarkPartner::tg, and update_ping_data().

Referenced by GNUNET_ATS_TEST_generate_traffic_start(), and GNUNET_ATS_TEST_traffic_handle_pong().

146 {
147  struct BenchmarkPartner *p = cls;
148  struct TestMessage *msg;
149  struct GNUNET_MQ_Envelope *env;
150 
151  p->tg->send_task = NULL;
153  env = GNUNET_MQ_msg (msg,
155  memset (msg->padding,
156  'a',
157  sizeof(msg->padding));
160  p);
162  "Master [%u]: Sending PING to [%u]\n",
163  p->me->no,
164  p->dest->no);
165  GNUNET_MQ_send (p->mq,
166  env);
167 }
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
static void update_ping_data(void *cls)
#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
uint8_t padding[100 - sizeof(struct GNUNET_MessageHeader)]
Definition: ats-testing.h:55
struct GNUNET_SCHEDULER_Task * send_task
Definition: ats-testing.h:244
struct TrafficGenerator * tg
Handle for traffic generator.
Definition: ats-testing.h:295
int no
Unique identifier.
Definition: ats-testing.h:121
static struct GNUNET_OS_Process * p
Helper process we started.
Definition: gnunet-qr.c:59
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
Information about a benchmarking partner.
Definition: ats-testing.h:275
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_get(void)
Get the current time.
Definition: time.c:118
struct GNUNET_TIME_Absolute last_message_sent
Timestamp to calculate communication layer delay.
Definition: ats-testing.h:305
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
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
Here is the call graph for this function:
Here is the caller graph for this function:

◆ update_pong_data()

static void update_pong_data ( void *  cls)
static

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

References BenchmarkPartner::bytes_sent, BenchmarkPartner::me, BenchmarkPartner::messages_sent, p, TEST_MESSAGE_SIZE, BenchmarkPeer::total_bytes_sent, and BenchmarkPeer::total_messages_sent.

Referenced by GNUNET_ATS_TEST_traffic_handle_ping().

172 {
173  struct BenchmarkPartner *p = cls;
174 
175  p->messages_sent++;
177  p->me->total_messages_sent++;
179 }
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_messages_sent
Total number of messages this peer has sent.
Definition: ats-testing.h:212
static struct GNUNET_OS_Process * p
Helper process we started.
Definition: gnunet-qr.c:59
Information about a benchmarking partner.
Definition: ats-testing.h:275
unsigned int bytes_sent
Number of bytes sent to this partner.
Definition: ats-testing.h:320
struct BenchmarkPeer * me
The peer itself this partner belongs to.
Definition: ats-testing.h:280
#define TEST_MESSAGE_SIZE
Size of test messages.
Definition: ats-testing.h:48
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 183 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().

184 {
185  struct TestMessage *msg;
186  struct GNUNET_MQ_Envelope *env;
187 
189  "Slave [%u]: Received PING from [%u], sending PONG\n",
190  p->me->no,
191  p->dest->no);
192  p->messages_received++;
196 
197 
198  env = GNUNET_MQ_msg (msg,
200  memset (msg->padding,
201  'a',
202  sizeof(msg->padding));
205  p);
206  GNUNET_MQ_send (p->mq,
207  env);
208 }
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 212 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().

213 {
214  struct GNUNET_TIME_Relative left;
215 
217  "Master [%u]: Received PONG from [%u], next message\n",
218  p->me->no,
219  p->dest->no);
220 
221  p->messages_received++;
227  .rel_value_us;
228 
229  /* Schedule next send event */
230  if (NULL == p->tg)
231  return;
232 
234  if (UINT32_MAX == p->tg->base_rate)
235  {
237  }
238  else if (0 == left.rel_value_us)
239  {
241  }
242  else
243  {
244  /* Enforce minimum transmission rate 1 msg / sec */
245  if (GNUNET_TIME_UNIT_SECONDS.rel_value_us == (left =
247  left,
249  .rel_value_us)
251  "Enforcing minimum send rate between master [%u] and slave [%u]\n",
252  p->me->no, p->dest->no);
254  &comm_schedule_send, p);
255  }
256 }
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:1253
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:1280
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:272
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:354
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 273 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().

280 {
281  struct TrafficGenerator *tg;
282 
283  if (NULL != dest->tg)
284  {
285  GNUNET_break (0);
286  return NULL;
287  }
288 
289  tg = GNUNET_new (struct TrafficGenerator);
291  tg_tail,
292  tg);
293  tg->type = type;
294  tg->src = src;
295  tg->dest = dest;
296  tg->base_rate = base_rate;
297  tg->max_rate = max_rate;
298  tg->duration_period = period;
301 
302  switch (type)
303  {
306  "Setting up constant traffic generator master[%u] `%s' and slave [%u] `%s' max %u Bips\n",
307  dest->me->no,
308  GNUNET_i2s (&dest->me->id),
309  dest->dest->no,
310  GNUNET_i2s (&dest->dest->id),
311  base_rate);
312  break;
313 
316  "Setting up linear traffic generator master[%u] `%s' and slave [%u] `%s' min %u Bips max %u Bips\n",
317  dest->me->no,
318  GNUNET_i2s (&dest->me->id),
319  dest->dest->no,
320  GNUNET_i2s (&dest->dest->id),
321  base_rate,
322  max_rate);
323  break;
324 
327  "Setting up sinus traffic generator master[%u] `%s' and slave [%u] `%s' baserate %u Bips, amplitude %u Bps\n",
328  dest->me->no,
329  GNUNET_i2s (&dest->me->id),
330  dest->dest->no,
331  GNUNET_i2s (&dest->dest->id),
332  base_rate,
333  max_rate);
334  break;
335 
338  "Setting up random traffic generator master[%u] `%s' and slave [%u] `%s' min %u Bips max %u Bps\n",
339  dest->me->no,
340  GNUNET_i2s (&dest->me->id),
341  dest->dest->no,
342  GNUNET_i2s (&dest->dest->id),
343  base_rate,
344  max_rate);
345  break;
346 
347  default:
348  break;
349  }
350 
351  dest->tg = tg;
352  tg->send_task
354  dest);
355  return tg;
356 }
#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:1280
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 360 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().

361 {
363  tg_tail,
364  tg);
365  tg->dest->tg = NULL;
366  if (NULL != tg->send_task)
367  {
369  tg->send_task = NULL;
370  }
371  GNUNET_free (tg);
372 }
#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:966
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 379 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().

380 {
381  struct TrafficGenerator *cur;
382  struct TrafficGenerator *next;
383 
384  next = tg_head;
385  for (cur = next; NULL != cur; cur = next)
386  {
387  next = cur->next;
389  }
390 }
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:

Variable Documentation

◆ tg_head

struct TrafficGenerator* tg_head
static

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

Referenced by GNUNET_ATS_TEST_generate_traffic_stop_all().

◆ tg_tail

struct TrafficGenerator* tg_tail
static

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

◆ top

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