The FreeRADIUS server $Id: a4e7f8c94e8038b7627bcf52356b7ed15955c1d7 $
Loading...
Searching...
No Matches
Macros | Functions | Variables
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_GLOBAL_INIT   pair_list_perf_init()
 
#define TEST_MSG_STATS
 

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 int fr_pair_sublist_copy (TALLOC_CTX *ctx, fr_pair_list_t *to, fr_pair_list_t const *from, fr_pair_t const *start)
 Duplicate a list of pairs starting at a particular item.
 
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)
 

Variables

static TALLOC_CTX * autofree
 
static fr_pair_t ** source_vps_0
 List with zero duplicate attributes.
 
static fr_pair_t ** source_vps_100
 List with 100% duplicate attributes, i.e. all the same.
 
static fr_pair_t ** source_vps_25
 List with 25% duplicate attributes.
 
static fr_pair_t ** source_vps_50
 List with 50% duplicate attributes.
 
static fr_pair_t ** source_vps_75
 List with 75% duplicate attributes.
 
static char const * test_attrs_0
 
static char const * test_attrs_100
 
static char const * test_attrs_25
 
static char const * test_attrs_50
 
static char const * test_attrs_75
 
static fr_dict_t * test_dict
 

Detailed Description

Performance tests for lists of fr_pair_t.

Author
Nick Porter ("nick.porter@networkradius.com")

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 521 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 508 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 514 of file pair_list_perf_test.c.

◆ TEST_GLOBAL_INIT

#define TEST_GLOBAL_INIT   pair_list_perf_init()

Definition at line 26 of file pair_list_perf_test.c.

◆ TEST_MSG_STATS

#define TEST_MSG_STATS
Value:
do { \
int64_t used_ns = fr_time_delta_unwrap(used); \
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, used_ns); \
TEST_MSG_ALWAYS("calls/s = %0.0lf", (reps * len)/((double)used_ns / (double)NSEC)); \
TEST_MSG_ALWAYS("(ns) / call = %0.0lf", (double) used_ns / (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:1061

Definition at line 38 of file pair_list_perf_test.c.

Function Documentation

◆ all_test_funcs()

all_test_funcs ( fr_pair_append  )

Definition at line 528 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 433 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 353 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 391 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 478 of file pair_list_perf_test.c.

+ Here is the call graph for this function:

◆ fr_pair_sublist_copy()

static int fr_pair_sublist_copy ( TALLOC_CTX *  ctx,
fr_pair_list_t *  to,
fr_pair_list_t const *  from,
fr_pair_t const *  start 
)
static

Duplicate a list of pairs starting at a particular item.

Copy all pairs from 'from' regardless of tag, attribute or vendor, starting at 'item'.

Parameters
[in]ctxfor new fr_pair_t (s) to be allocated in.
[in]towhere to copy attributes to.
[in]fromwhence to copy fr_pair_t (s).
[in]startfirst pair to start copying from.
Returns
  • >0 the number of attributes copied.
  • 0 if no attributes copied.
  • -1 on error.

Definition at line 185 of file pair_list_perf_test.c.

+ Here is the call graph for this function:
+ Here is the caller 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 216 of file pair_list_perf_test.c.

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

◆ pair_list_perf_init()

void pair_list_perf_init ( void  )
static

Definition at line 323 of file pair_list_perf_test.c.

+ Here is the call graph for this function:

Variable Documentation

◆ autofree

TALLOC_CTX* autofree
static

Definition at line 54 of file pair_list_perf_test.c.

◆ source_vps_0

fr_pair_t** source_vps_0
static

List with zero duplicate attributes.

Definition at line 166 of file pair_list_perf_test.c.

◆ source_vps_100

fr_pair_t** source_vps_100
static

List with 100% duplicate attributes, i.e. all the same.

Definition at line 170 of file pair_list_perf_test.c.

◆ source_vps_25

fr_pair_t** source_vps_25
static

List with 25% duplicate attributes.

Definition at line 167 of file pair_list_perf_test.c.

◆ source_vps_50

fr_pair_t** source_vps_50
static

List with 50% duplicate attributes.

Definition at line 168 of file pair_list_perf_test.c.

◆ source_vps_75

fr_pair_t** source_vps_75
static

List with 75% duplicate attributes.

Definition at line 169 of file pair_list_perf_test.c.

◆ test_attrs_0

char const* test_attrs_0
static
Initial value:
=
"Test-String-# = \"hello\","
"Test-Octets-# = 0x0102030405060708,"
"Test-IPv4-Addr-# = 192.168.1.1,"
"Test-IPv4-Prefix-# = 192.168/16,"
"Test-IPv6-Addr-# = fd12:3456:789a:1::1,"
"Test-IPv6-Prefix-# = fd12:3456:789a:1::/64,"
"Test-Ethernet-# = 11:22:33:44:55:66,"
"Test-Uint8-# = 255,"
"Test-Uint16-# = 65535,"
"Test-Uint32-# = 4294967295,"
"Test-Uint64-# = 18446744073709551615,"
"Test-Int8-# = -120,"
"Test-Int16-# = -4573,"
"Test-Int32-# = 45645,"
"Test-Int64-# = 85645,"
"Test-Float32-# = 1.134,"
"Test-Float64-# = 1.1345,"
"Test-Date-# += \"Jan 1 2020 00:00:00 UTC\","
"Test-TLV-#.String = \"nested\","
"Test-Struct-#.uint32 = 1234"

Definition at line 56 of file pair_list_perf_test.c.

◆ test_attrs_100

char const* test_attrs_100
static
Initial value:
=
"Test-String-# += \"hello\","
"Test-String-# += \"goodbye\","
"Test-String-# += \"hola\","
"Test-String-# += \"hasta pronto\","
"Test-String-# += \"bonjour\","
"Test-String-# += \"au revoir\","
"Test-String-# += \"halo\","
"Test-String-# += \"kwaheri\","
"Test-String-# += \"ciao\","
"Test-String-# += \"arrivederci\","
"Test-String-# += \"halo\","
"Test-String-# += \"selamat tinggal\","
"Test-String-# += \"你好\","
"Test-String-# += \"再见\","
"Test-String-# += \"Я люблю сир\","
"Test-String-# += \"Найкращий сир - бринза\","
"Test-String-# += \"Сулугуні чудовий на грилі\","
"Test-String-# += \"Сирники з домашнього сиру\","
"Test-String-# += \"Карпатська бринза пахне гірськими травами\","
"Test-String-# += \"Вареники з сиром найсмачніші\""

Definition at line 144 of file pair_list_perf_test.c.

◆ test_attrs_25

char const* test_attrs_25
static
Initial value:
=
"Test-String-# += \"hello\","
"Test-String-# += \"goodbye\","
"Test-String-# += \"hola\","
"Test-String-# += \"hasta pronto\","
"Test-String-# += \"bonjour\","
"Test-Octets-# += 0x0102030405060708,"
"Test-IPv4-Addr-# = 192.168.1.1,"
"Test-IPv4-Prefix-# = 192.168/16,"
"Test-IPv6-Addr-# = fd12:3456:789a:1::1,"
"Test-IPv6-Prefix-# = fd12:3456:789a:1::/64,"
"Test-Ethernet-# = 11:22:33:44:55:66,"
"Test-Uint8-# = 255,"
"Test-Uint16-# = 65535,"
"Test-Uint32-# = 4294967295,"
"Test-Uint64-# = 18446744073709551615,"
"Test-Int64-# = 85645,"
"Test-Float32-# = 1.134,"
"Test-Date-# += \"Jan 1 2020 00:00:00 UTC\","
"Test-TLV-#.String = \"nested\","
"Test-Struct-#.uint32 = 1234"

Definition at line 78 of file pair_list_perf_test.c.

◆ test_attrs_50

char const* test_attrs_50
static
Initial value:
=
"Test-String-# += \"hello\","
"Test-String-# += \"goodbye\","
"Test-String-# += \"hola\","
"Test-String-# += \"hasta pronto\","
"Test-String-# += \"bonjour\","
"Test-String-# += \"au revoir\","
"Test-String-# += \"halo\","
"Test-String-# += \"kwaheri\","
"Test-String-# += \"ciao\","
"Test-String-# += \"arrivederci\","
"Test-IPv4-Addr-# = 192.168.1.1,"
"Test-IPv4-Prefix-# = 192.168/16,"
"Test-IPv6-Addr-# = fd12:3456:789a:1::1,"
"Test-IPv6-Prefix-# = fd12:3456:789a:1::/64,"
"Test-Ethernet-# = 11:22:33:44:55:66,"
"Test-Uint8-# = 255,"
"Test-Int64-# = 85645,"
"Test-Date-# += \"Jan 1 2020 00:00:00 UTC\","
"Test-TLV-#.String = \"nested\","
"Test-Struct-#.uint32 = 1234"

Definition at line 100 of file pair_list_perf_test.c.

◆ test_attrs_75

char const* test_attrs_75
static
Initial value:
=
"Test-String-# += \"hello\","
"Test-String-# += \"goodbye\","
"Test-String-# += \"hola\","
"Test-String-# += \"hasta pronto\","
"Test-String-# += \"bonjour\","
"Test-String-# += \"au revoir\","
"Test-String-# += \"halo\","
"Test-String-# += \"kwaheri\","
"Test-String-# += \"ciao\","
"Test-String-# += \"arrivederci\","
"Test-String-# += \"halo\","
"Test-String-# += \"selamat tinggal\","
"Test-String-# += \"你好\","
"Test-String-# += \"再见\","
"Test-String-# += \"Я люблю сир\","
"Test-Uint8-# = 255,"
"Test-Int64-# = 85645,"
"Test-Date-# += \"Jan 1 2020 00:00:00 UTC\","
"Test-TLV-#.String = \"nested\","
"Test-Struct-#.uint32 = 1234"

Definition at line 122 of file pair_list_perf_test.c.

◆ test_dict

fr_dict_t* test_dict
static

Definition at line 53 of file pair_list_perf_test.c.