The FreeRADIUS server $Id: f3670dba8951ca10eb4948feb3dc3db9423a334f $
Loading...
Searching...
No Matches
Macros | Functions
pair_list_perf_test.c File Reference

Performance tests for lists of fr_pair_t. More...

#include "acutest_common_init.h"
#include <freeradius-devel/util/dict_test.h>
#include <freeradius-devel/server/base.h>
+ Include dependency graph for pair_list_perf_test.c:

Go to the source code of this file.

Macros

#define all_repetition_tests(_func)
 
#define all_test_funcs(_func)
 
#define repetition_tests(_func, _perc)
 
#define test_func(_func, _count, _perc, _source_vps)
 
#define test_funcs(_func, _perc)
 
#define TEST_MSG_STATS
 
#define USE_CONSTRUCTOR
 The 'TEST_INIT' macro provided by 'acutest.h' allows registering a function to be called before call the unit tests.
 

Functions

 all_test_funcs (fr_pair_append)
 
static void do_test_find_nth (unsigned int len, unsigned int perc, unsigned int reps, fr_pair_t *source_vps[])
 
static void do_test_fr_pair_append (unsigned int len, unsigned int perc, unsigned int reps, fr_pair_t *source_vps[])
 
static void do_test_fr_pair_find_by_da (unsigned int len, unsigned int perc, unsigned int reps, fr_pair_t *source_vps[])
 
static void do_test_fr_pair_list_free (unsigned int len, unsigned int perc, unsigned int reps, fr_pair_t *source_vps[])
 
static void pair_list_init (TALLOC_CTX *ctx, fr_pair_t ***out, fr_dict_t const *dict, char const *pairs, int const perc, int const reps)
 
static void pair_list_perf_init (void)
 

Detailed Description

Performance tests for lists of fr_pair_t.

Author
Nick Porter nick..nosp@m.port.nosp@m.er@ne.nosp@m.twor.nosp@m.kradi.nosp@m.us.c.nosp@m.om

Definition in file pair_list_perf_test.c.

Macro Definition Documentation

◆ all_repetition_tests

#define all_repetition_tests (   _func)
Value:
repetition_tests(_func, 0) \
repetition_tests(_func, 25) \
repetition_tests(_func, 50) \
repetition_tests(_func, 75) \
repetition_tests(_func, 100)
#define repetition_tests(_func, _perc)

◆ all_test_funcs

#define all_test_funcs (   _func)
Value:
test_funcs(_func, 0) \
test_funcs(_func, 25) \
test_funcs(_func, 50) \
test_funcs(_func, 75) \
test_funcs(_func, 100)
#define test_funcs(_func, _perc)

Definition at line 538 of file pair_list_perf_test.c.

◆ repetition_tests

#define repetition_tests (   _func,
  _perc 
)
Value:
{ #_func "_20_" #_perc, test_ ## _func ## _20_ ## _perc},\
{ #_func "_40_" #_perc, test_ ## _func ## _40_ ## _perc},\
{ #_func "_60_" #_perc, test_ ## _func ## _60_ ## _perc},\
{ #_func "_80_" #_perc, test_ ## _func ## _80_ ## _perc},\
{ #_func "_100_" #_perc, test_ ## _func ## _100_ ## _perc},\

◆ test_func

#define test_func (   _func,
  _count,
  _perc,
  _source_vps 
)
Value:
static void test_ ## _func ## _ ## _count ## _ ## _perc(void)\
{\
do_test_ ## _func(_count, _perc, 10000, _source_vps);\
}

Definition at line 525 of file pair_list_perf_test.c.

◆ test_funcs

#define test_funcs (   _func,
  _perc 
)
Value:
test_func(_func, 20, _perc, source_vps_ ## _perc) \
test_func(_func, 40, _perc, source_vps_ ## _perc) \
test_func(_func, 60, _perc, source_vps_ ## _perc) \
test_func(_func, 80, _perc, source_vps_ ## _perc) \
test_func(_func, 100, _perc, source_vps_ ## _perc)
#define test_func(_func, _count, _perc, _source_vps)

Definition at line 531 of file pair_list_perf_test.c.

◆ TEST_MSG_STATS

#define TEST_MSG_STATS
Value:
do { \
TEST_MSG_ALWAYS("\n"); \
TEST_MSG_ALWAYS("repetitions = %u", reps); \
TEST_MSG_ALWAYS("%% repeated = %u", perc); \
TEST_MSG_ALWAYS("list_length = %u", len); \
TEST_MSG_ALWAYS("elapsed (ns) = %" PRId64, fr_time_delta_unwrap(used)); \
TEST_MSG_ALWAYS("calls/s = %0.0lf", (reps * len)/(fr_time_delta_unwrap(used) / (double)NSEC)); \
TEST_MSG_ALWAYS("(ns) / call = %0.0lf", (double) fr_time_delta_unwrap(used) / (double) reps); \
} while (0)
static size_t used
static int64_t fr_time_delta_unwrap(fr_time_delta_t time)
Definition time.h:154
#define NSEC
Definition time.h:379
static fr_sbuff_err_t char size_t * len
Definition value.h:1062

◆ USE_CONSTRUCTOR

#define USE_CONSTRUCTOR

The 'TEST_INIT' macro provided by 'acutest.h' allows registering a function to be called before call the unit tests.

Therefore, It calls the function ALL THE TIME causing an overhead. That is why we are initializing pair_list_perf_init() by "__attribute__((constructor));" reducing the test execution by 50% of the time.

Definition at line 31 of file pair_list_perf_test.c.

Function Documentation

◆ all_test_funcs()

all_test_funcs ( fr_pair_append  )

Definition at line 545 of file pair_list_perf_test.c.

+ Here is the call graph for this function:

◆ do_test_find_nth()

static void do_test_find_nth ( unsigned int  len,
unsigned int  perc,
unsigned int  reps,
fr_pair_t *  source_vps[] 
)
static

Definition at line 450 of file pair_list_perf_test.c.

+ Here is the call graph for this function:

◆ do_test_fr_pair_append()

static void do_test_fr_pair_append ( unsigned int  len,
unsigned int  perc,
unsigned int  reps,
fr_pair_t *  source_vps[] 
)
static

Definition at line 370 of file pair_list_perf_test.c.

+ Here is the call graph for this function:

◆ do_test_fr_pair_find_by_da()

static void do_test_fr_pair_find_by_da ( unsigned int  len,
unsigned int  perc,
unsigned int  reps,
fr_pair_t *  source_vps[] 
)
static

Definition at line 408 of file pair_list_perf_test.c.

+ Here is the call graph for this function:

◆ do_test_fr_pair_list_free()

static void do_test_fr_pair_list_free ( unsigned int  len,
unsigned int  perc,
unsigned int  reps,
fr_pair_t *  source_vps[] 
)
static

Definition at line 495 of file pair_list_perf_test.c.

+ Here is the call graph for this function:

◆ pair_list_init()

static void pair_list_init ( TALLOC_CTX *  ctx,
fr_pair_t ***  out,
fr_dict_t const *  dict,
char const *  pairs,
int const  perc,
int const  reps 
)
static

Definition at line 230 of file pair_list_perf_test.c.

+ Here is the call graph for this function:

◆ pair_list_perf_init()

void pair_list_perf_init ( void  )
static

Definition at line 37 of file pair_list_perf_test.c.