function libtest_testsuite_init

From liblfds.org
Jump to navigation Jump to search

Source Files

└── test_and_benchmark
    └── libtest
        ├── inc
        │   └── libtest
        │       └── libtest_testsuite.h
        └── src
            └── libshared_memory
                └── libtest_testsuite_init.c

Opaque Structures

struct libtest_testsuite_state;

Prototype

void libtest_testsuite_init( struct libtest_testsuite_state *ts,
                             struct libshared_memory_state *ms,
                             void (*callback_test_start)(char *test_name),
                             void (*callback_test_finish)(char *result) );

Parameters

struct libtest_testsuite_state *ts

A pointer to a user-allocated LFDS711_PAL_ATOMIC_ISOLATION_IN_BYTES aligned struct libtest_testsuite_state. Stack declared variables will automatically be correctly aligned by the compiler, due to the information in the structure definitions; nothing has to be done. Heap allocated variables however will by no means be correctly aligned and an aligned malloc must be used.

struct libshared_memory_state *ms

A pointer to an initialized struct libshared_memory_state. The memory state must be initialized with enough memory for the testsuite to run. See Notes for information about minimum and recommended memory sizes and NUMA awareness.

void (*callback_test_start)(char *test_name)

The testsuite takes quite a long time to run. As such, the test code reports on the progress of tests as they occur. THis argument is a pointer to a function which when a new test begins, is passed the name of that test. This argument can be NULL.

void (*callback_test_finish)(char *result) )

The testsuite takes quite a long time to run. As such, the test code reports on the progress of tests as they occur. THis argument is a pointer to a function which when a test completes, is passed a string which describes the outcome of the test. This argument can be NULL.

Notes

The test codebase should be written so that it can inform the caller how much memory is used, but this has not yet been done; it is a time consuming change, and it was a large enough first change to move over fully to externally provided memory. In general, 4mb is the minimum, 64mb is a reasonable minimum, the default is 512mb. The amount of memory required is not sensitive to the number of logical cores in the system - in general, a test simply allocates as many test elements as it can, from the memory that is available. The test code is not NUMA aware and when it performs allocations, simply allocates from the currently largest free block in the memory state.

Example

See Also