The FreeRADIUS server $Id: f3670dba8951ca10eb4948feb3dc3db9423a334f $
Loading...
Searching...
No Matches
Data Structures | Macros | Enumerations | Functions
load.c File Reference

Load generation algorithms. More...

#include <freeradius-devel/io/load.h>
+ Include dependency graph for load.c:

Go to the source code of this file.

Data Structures

struct  fr_load_s
 

Macros

#define DIFF(_rtt, _t)
 
#define IALPHA   (8)
 
#define IBETA   (4)
 
#define RTT(_old, _new)   fr_time_delta_wrap((fr_time_delta_unwrap(_new) + (fr_time_delta_unwrap(_old) * (IALPHA - 1))) / IALPHA)
 
#define RTTVAR(_rtt, _rttvar, _t)
 

Enumerations

enum  fr_load_state_t {
  FR_LOAD_STATE_INIT = 0 ,
  FR_LOAD_STATE_SENDING ,
  FR_LOAD_STATE_GATED ,
  FR_LOAD_STATE_DRAINING
}
 

Functions

fr_load_tfr_load_generator_create (TALLOC_CTX *ctx, fr_event_list_t *el, fr_load_config_t *config, fr_load_callback_t callback, fr_load_done_callback_t done, void *uctx)
 
fr_load_reply_t fr_load_generator_have_reply (fr_load_t *l, fr_time_t request_time)
 Tell the load generator that we have a reply to a packet we sent.
 
static void fr_load_generator_send (fr_load_t *l, fr_time_t now, int count)
 Send one or more packets.
 
int fr_load_generator_start (fr_load_t *l)
 Start the load generator.
 
fr_load_stats_t const * fr_load_generator_stats (fr_load_t const *l)
 
size_t fr_load_generator_stats_sprint (fr_load_t *l, fr_time_t now, char *buffer, size_t buflen)
 Print load generator statistics in CVS format.
 
int fr_load_generator_stop (fr_load_t *l)
 Stop the load generation through the simple expedient of deleting the timer associated with it.
 
static void load_drain (fr_load_t *l, fr_time_t now)
 Stop sending new packets, and wait for outstanding replies.
 
static void load_timer (fr_timer_list_t *tl, fr_time_t now, void *uctx)
 

Detailed Description

Load generation algorithms.

Id
ed962a7e3768f414686f5b0d854eb8380b5485cf

Definition in file load.c.


Data Structure Documentation

◆ fr_load_s

struct fr_load_s

Definition at line 65 of file load.c.

+ Collaboration diagram for fr_load_s:
Data Fields
fr_load_callback_t callback
fr_load_config_t const * config
uint32_t count
fr_time_delta_t delta between packets
fr_load_done_callback_t done
fr_event_list_t * el
fr_timer_t * ev
bool header for printing statistics
fr_time_t next The next time we're supposed to send a packet.
uint32_t pps
int sent_base stats.sent when this run started, so that max_requests counts per-run, not cumulatively
fr_load_state_t state
fr_load_stats_t stats sending statistics
fr_time_t step_end when the current step will end
int step_received
fr_time_t step_start when the current step started
void * uctx

Macro Definition Documentation

◆ DIFF

#define DIFF (   _rtt,
  _t 
)
Value:
(\
fr_time_delta_lt(_rtt, _t) ? \
fr_time_delta_sub(_t, _rtt) : \
fr_time_delta_sub(_rtt, _t)\
)
static fr_time_delta_t fr_time_delta_sub(fr_time_delta_t a, fr_time_delta_t b)
Definition time.h:261

Definition at line 40 of file load.c.

◆ IALPHA

#define IALPHA   (8)

Definition at line 38 of file load.c.

◆ IBETA

#define IBETA   (4)

Definition at line 37 of file load.c.

◆ RTT

#define RTT (   _old,
  _new 
)    fr_time_delta_wrap((fr_time_delta_unwrap(_new) + (fr_time_delta_unwrap(_old) * (IALPHA - 1))) / IALPHA)

Definition at line 56 of file load.c.

◆ RTTVAR

#define RTTVAR (   _rtt,
  _rttvar,
  _t 
)
Value:
fr_time_delta_mul(_rttvar, IBETA - 1), \
DIFF(_rtt, _t)\
), \
)
#define DIFF(_rtt, _t)
Definition load.c:40
#define IBETA
Definition load.c:37
static fr_time_delta_t fr_time_delta_add(fr_time_delta_t a, fr_time_delta_t b)
Definition time.h:255
#define fr_time_delta_wrap(_time)
Definition time.h:152
static fr_time_delta_t fr_time_delta_mul(fr_time_delta_t a, int64_t b)
Definition time.h:273
static fr_time_delta_t fr_time_delta_div(fr_time_delta_t a, fr_time_delta_t b)
Definition time.h:267

Definition at line 47 of file load.c.

Enumeration Type Documentation

◆ fr_load_state_t

Enumerator
FR_LOAD_STATE_INIT 
FR_LOAD_STATE_SENDING 
FR_LOAD_STATE_GATED 
FR_LOAD_STATE_DRAINING 

Definition at line 58 of file load.c.

Function Documentation

◆ fr_load_generator_create()

fr_load_t * fr_load_generator_create ( TALLOC_CTX *  ctx,
fr_event_list_t el,
fr_load_config_t config,
fr_load_callback_t  callback,
fr_load_done_callback_t  done,
void *  uctx 
)

Definition at line 90 of file load.c.

+ Here is the caller graph for this function:

◆ fr_load_generator_have_reply()

fr_load_reply_t fr_load_generator_have_reply ( fr_load_t l,
fr_time_t  request_time 
)

Tell the load generator that we have a reply to a packet we sent.

Definition at line 324 of file load.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_load_generator_send()

static void fr_load_generator_send ( fr_load_t l,
fr_time_t  now,
int  count 
)
static

Send one or more packets.

Definition at line 115 of file load.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_load_generator_start()

int fr_load_generator_start ( fr_load_t l)

Start the load generator.

Definition at line 277 of file load.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_load_generator_stats()

fr_load_stats_t const * fr_load_generator_stats ( fr_load_t const *  l)

Definition at line 452 of file load.c.

+ Here is the caller graph for this function:

◆ fr_load_generator_stats_sprint()

size_t fr_load_generator_stats_sprint ( fr_load_t l,
fr_time_t  now,
char *  buffer,
size_t  buflen 
)

Print load generator statistics in CVS format.

Definition at line 406 of file load.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fr_load_generator_stop()

int fr_load_generator_stop ( fr_load_t l)

Stop the load generation through the simple expedient of deleting the timer associated with it.

Definition at line 312 of file load.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ load_drain()

static void load_drain ( fr_load_t l,
fr_time_t  now 
)
static

Stop sending new packets, and wait for outstanding replies.

If every reply has already arrived then the test is complete right now, so run the "done" callback. Otherwise completion is signalled by fr_load_generator_have_reply() when the last reply comes in.

Definition at line 140 of file load.c.

+ Here is the caller graph for this function:

◆ load_timer()

static void load_timer ( fr_timer_list_t tl,
fr_time_t  now,
void *  uctx 
)
static

Definition at line 150 of file load.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function: