25 RCSID(
"$Id: fad5700eff479d44ac12b188428b8c75157f2ebb $")
27 #include <freeradius-devel/io/load.h>
40 #define DIFF(_rtt, _t) \
42 fr_time_delta_lt(_rtt, _t) ? \
43 fr_time_delta_sub(_t, _rtt) : \
44 fr_time_delta_sub(_rtt, _t)\
47 #define RTTVAR(_rtt, _rttvar, _t) \
50 fr_time_delta_mul(_rttvar, IBETA - 1), \
53 fr_time_delta_wrap(IBETA)\
56 #define RTT(_old, _new) fr_time_delta_wrap((fr_time_delta_unwrap(_new) + (fr_time_delta_unwrap(_old) * (IALPHA - 1))) / IALPHA)
124 for (i = 0; i <
count; i++) {
254 if (!l->
ev)
return 0;
343 double now_f, last_send_f;
347 return snprintf(
buffer, buflen,
"\"time\",\"last_packet\",\"rtt\",\"rttvar\",\"pps\",\"pps_accepted\",\"sent\",\"received\",\"backlog\",\"max_backlog\",\"<usec\",\"us\",\"10us\",\"100us\",\"ms\",\"10ms\",\"100ms\",\"s\",\"blocked\"\n");
371 "%" PRIu64
",%" PRIu64
","
375 "%d,%d,%d,%d,%d,%d,%d,%d,"
static int const char char buffer[256]
fr_dcursor_eval_t void const * uctx
#define fr_event_timer_in(...)
int fr_event_timer_delete(fr_event_timer_t const **ev_p)
Delete a timer event from the event list.
Stores all information relating to an event list.
static void load_timer(fr_event_list_t *el, fr_time_t now, void *uctx)
static void fr_load_generator_send(fr_load_t *l, fr_time_t now, int count)
Send one or more packets.
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, void *uctx)
#define RTTVAR(_rtt, _rttvar, _t)
fr_time_t step_start
when the current step started
fr_time_t step_end
when the current step will end
fr_load_callback_t callback
fr_time_delta_t delta
between packets
fr_event_timer_t const * ev
fr_time_t next
The next time we're supposed to send a packet.
int fr_load_generator_start(fr_load_t *l)
Start the load generator.
int fr_load_generator_stop(fr_load_t *l)
Stop the load generation through the simple expedient of deleting the timer associated with it.
fr_load_stats_t stats
sending statistics
fr_load_config_t const * config
bool header
for printing statistics
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.
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.
fr_load_stats_t const * fr_load_generator_stats(fr_load_t const *l)
int sent
total packets sent
fr_time_t last_send
last packet we sent
fr_time_delta_t rtt
smoothed round trip time
int times[8]
response time in microseconds to tens of seconds
int received
total packets received (should be == sent)
int(* fr_load_callback_t)(fr_time_t now, void *uctx)
int skipped
we skipped sending this number of packets
bool blocked
whether or not we're blocked
fr_time_t end
when the test started
int pps_accepted
Accepted PPS for the last second.
uint32_t start_pps
start PPS
int pps
current offered packets/s
fr_load_reply_t
Whether or not the application should continue.
@ FR_LOAD_DONE
the load generator is done
@ FR_LOAD_CONTINUE
continue sending packets.
uint32_t parallel
how many packets in parallel to send
fr_time_delta_t duration
duration of each step
int backlog
current backlog
uint32_t step
how much to increase each load test by
int max_backlog
maximum backlog we saw during the test
fr_time_delta_t rttvar
RTT variation.
uint32_t max_pps
max PPS, 0 for "no limit".
uint32_t milliseconds
how many milliseconds of backlog to top out at
Load generation configuration.
static const conf_parser_t config[]
PUBLIC int snprintf(char *string, size_t length, char *format, va_alist)
#define fr_time()
Allow us to arbitrarily manipulate time.
#define fr_time_gteq(_a, _b)
static int64_t fr_time_delta_unwrap(fr_time_delta_t time)
#define fr_time_delta_lt(_a, _b)
static fr_time_delta_t fr_time_delta_from_sec(int64_t sec)
#define fr_time_delta_wrap(_time)
#define fr_time_add(_a, _b)
Add a time/time delta together.
#define fr_time_gt(_a, _b)
static fr_time_delta_t fr_time_delta_from_nsec(int64_t nsec)
#define fr_time_sub(_a, _b)
Subtract one time from another.
static fr_time_delta_t fr_time_delta_div(fr_time_delta_t a, fr_time_delta_t b)
#define fr_time_lt(_a, _b)
A time delta, a difference in time measured in nanoseconds.
static fr_event_list_t * el