40 long long int cur_rate;
41 long long int delta_rate;
49 if (UINT32_MAX == tg->base_rate)
51 cur_rate = tg->base_rate;
58 % tg->duration_period.rel_value_us;
60 / tg->duration_period.rel_value_us)
61 * (tg->max_rate - tg->base_rate);
62 if ((tg->max_rate < tg->base_rate) && ((tg->max_rate - tg->base_rate) >
68 cur_rate = tg->base_rate + delta_rate;
82 % tg->duration_period.rel_value_us;
83 if ((tg->max_rate - tg->base_rate) > tg->base_rate)
89 delta_rate = (tg->max_rate - tg->base_rate)
91 / ((double) tg->duration_period.rel_value_us)
93 cur_rate = tg->base_rate + delta_rate;
110 "Current rate is %lld, calculated delay is %llu\n",
135 "Delay for next transmission %s\n",
162 "Master [%u]: Sending PING to [%u]\n",
189 "Slave [%u]: Received PING from [%u], sending PONG\n",
217 "Master [%u]: Received PONG from [%u], next message\n",
251 "Enforcing minimum send rate between master [%u] and slave [%u]\n",
283 if (NULL != dest->
tg)
306 "Setting up constant traffic generator master[%u] `%s' and slave [%u] `%s' max %u Bips\n",
316 "Setting up linear traffic generator master[%u] `%s' and slave [%u] `%s' min %u Bips max %u Bips\n",
327 "Setting up sinus traffic generator master[%u] `%s' and slave [%u] `%s' baserate %u Bips, amplitude %u Bps\n",
338 "Setting up random traffic generator master[%u] `%s' and slave [%u] `%s' min %u Bips max %u Bps\n",
385 for (cur = next; NULL != cur; cur =
next)
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
unsigned int total_bytes_sent
Total number of bytes this peer has sent.
unsigned int messages_sent
Number of messages sent to this partner.
unsigned int total_bytes_received
Total number of bytes this peer has received.
struct GNUNET_MessageHeader * msg
uint64_t rel_value_us
The actual value.
struct TrafficGenerator * next
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
struct GNUNET_ATS_TEST_Topology * top
static void update_ping_data(void *cls)
static struct TrafficGenerator * tg_head
static void comm_schedule_send(void *cls)
uint32_t GNUNET_CRYPTO_random_u32(enum GNUNET_CRYPTO_Quality mode, uint32_t i)
Produce a random value.
#define GNUNET_TIME_UNIT_SECONDS
One second.
void GNUNET_ATS_TEST_traffic_handle_pong(struct BenchmarkPartner *p)
unsigned int total_messages_received
Total number of messages this peer has received.
#define TEST_MESSAGE_TYPE_PING
Message type sent for traffic generation.
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
unsigned int bytes_received
Number of bytes received from this partner.
uint8_t padding[100 - sizeof(struct GNUNET_MessageHeader)]
struct GNUNET_SCHEDULER_Task * send_task
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.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
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...
struct BenchmarkPartner * dest
#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.
#define GNUNET_TIME_UNIT_FOREVER_ABS
Constant used to specify "forever".
struct TrafficGenerator * tg
Handle for traffic generator.
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.
void GNUNET_ATS_TEST_traffic_handle_ping(struct BenchmarkPartner *p)
static struct GNUNET_OS_Process * p
Helper process we started.
struct GNUNET_TIME_Absolute time_start
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...
unsigned int total_app_rtt
Accumulated RTT for all messages.
static struct TrafficGenerator * tg_tail
Information we track for a peer in the testbed.
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.
const char * GNUNET_STRINGS_relative_time_to_string(struct GNUNET_TIME_Relative delta, int do_round)
Give relative time in human-readable fancy format.
Information about a benchmarking partner.
unsigned int messages_received
Number of messages received from this partner.
ats testing library: setup topology and provide logging to test ats
struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_get(void)
Get the current time.
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.
struct GNUNET_TIME_Absolute last_message_sent
Timestamp to calculate communication layer delay.
struct BenchmarkPeer * src
struct GNUNET_MQ_Envelope * env
static struct GNUNET_TIME_Relative delay
When should dkg communication start?
#define GNUNET_TIME_UNIT_ZERO
Relative time zero.
unsigned int bytes_sent
Number of bytes sent to this partner.
struct GNUNET_MQ_Handle * mq
Message queue handle.
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...
#define GNUNET_log(kind,...)
void GNUNET_ATS_TEST_generate_traffic_stop(struct TrafficGenerator *tg)
static struct GNUNET_TIME_Relative duration
How long do we run the test?
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?
struct GNUNET_TIME_Relative duration_period
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
void GNUNET_ATS_TEST_generate_traffic_stop_all()
Stop all traffic generators.
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.
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
static struct GNUNET_TIME_Relative get_delay(struct TrafficGenerator *tg)
static void update_pong_data(void *cls)
struct BenchmarkPeer * me
The peer itself this partner belongs to.
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.
struct GNUNET_PeerIdentity id
Peer ID.
struct GNUNET_TIME_Absolute next_ping_transmission
#define TEST_MESSAGE_SIZE
Size of test messages.
No good quality of the operation is needed (i.e., random numbers can be pseudo-random).
#define GNUNET_free(ptr)
Wrapper around free.
Time for relative time used by GNUnet, in microseconds.
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.