checkasm 1.0.1
Assembly testing and benchmarking framework
Loading...
Searching...
No Matches
CheckasmConfig Struct Reference

Configuration structure for the checkasm test suite. More...

#include <checkasm.h>

Collaboration diagram for CheckasmConfig:

Data Fields

const CheckasmCpuInfocpu_flags
 List of CPU flags understood by the implementation.
const CheckasmTesttests
 Array of test functions to execute.
CheckasmCpu cpu
 Detected CPU flags for the current system.
void(* set_cpu_flags )(CheckasmCpu new_flags)
 Callback invoked when active CPU flags change.
const char * test_pattern
 Pattern for filtering which tests to run.
const char * function_pattern
 Pattern for filtering which functions within tests to run.
int bench
 Enable benchmarking.
unsigned bench_usec
 Target benchmark duration in microseconds.
CheckasmFormat format
 Output format for benchmark results.
int verbose
 Enable verbose output.
unsigned seed
 Random number generator seed.
unsigned repeat
 Number of times to repeat tests.
int cpu_affinity_set
 Enable process pinning via cpu_affinity.
unsigned cpu_affinity
 CPU core ID for process pinning.

Detailed Description

Configuration structure for the checkasm test suite.

This structure contains all configuration options for running checkasm tests, including test selection, CPU feature flags, benchmarking options, and output formatting. Initialize this structure with your project's tests and CPU flags before calling checkasm_main() or checkasm_run().

CheckasmConfig config = {
.cpu_flags = my_cpu_flags,
.tests = my_tests,
.cpu = my_get_cpu_flags(),
.set_cpu_flags = my_set_cpu_flags,
};
return checkasm_main(&config, argc, argv);
CHECKASM_API int checkasm_main(CheckasmConfig *config, int argc, const char *argv[])
Main entry point for checkasm test programs.
Configuration structure for the checkasm test suite.
Definition checkasm.h:122
See also
checkasm_main(), checkasm_run()

Field Documentation

◆ bench

int CheckasmConfig::bench

Enable benchmarking.

When nonzero, enables performance benchmarking of tested functions. Set to 1 to enable with default settings.

◆ bench_usec

unsigned CheckasmConfig::bench_usec

Target benchmark duration in microseconds.

Target time (in µs) to spend benchmarking each function. Defaults to 1000 µs if left unset when bench is enabled.

Note
Very slow functions may execute for a longer duration to ensure enough samples are collected for accurate measurement.

◆ cpu

CheckasmCpu CheckasmConfig::cpu

Detected CPU flags for the current system.

Set this to the detected CPU capabilities of the system. Any extra flags not included in cpu_flags will also be transparently included in checkasm_get_cpu_flags(), and can be used to signal flags that should be assumed to always be enabled (e.g., CPU_FLAG_FAST_* modifiers).

◆ cpu_affinity

unsigned CheckasmConfig::cpu_affinity

CPU core ID for process pinning.

If cpu_affinity_set is nonzero, pin the test process to this CPU core.

◆ cpu_affinity_set

int CheckasmConfig::cpu_affinity_set

Enable process pinning via cpu_affinity.

If nonzero, the test process will be pinned to the CPU core specified in cpu_affinity.

◆ cpu_flags

const CheckasmCpuInfo* CheckasmConfig::cpu_flags

List of CPU flags understood by the implementation.

Array of CPU features that will be tested in incremental order, terminated by an entry with CheckasmCpuInfo.flag == 0 (i.e. {0}).

Each test run inherits any active flags from previously tested CPUs. This allows testing progressively more advanced instruction sets.

◆ function_pattern

const char* CheckasmConfig::function_pattern

Pattern for filtering which functions within tests to run.

Shell-style wildcard pattern to select specific functions. Matched against the names passed to checkasm_check_func(). NULL means run all functions.

◆ repeat

unsigned CheckasmConfig::repeat

Number of times to repeat tests.

Repeat the test (and benchmark, if enabled) this many times using successive seeds. Setting to -1 effectively tests every possible seed (useful for exhaustive testing).

◆ seed

unsigned CheckasmConfig::seed

Random number generator seed.

If nonzero, use this seed for deterministic random number generation. If zero, a seed will be chosen based on the current time.

◆ set_cpu_flags

void(* CheckasmConfig::set_cpu_flags) (CheckasmCpu new_flags)

Callback invoked when active CPU flags change.

If provided, this function will be called whenever the active set of CPU flags changes, with the new set of flags as argument. This includes once at the start of the program with the baseline set of flags.

Use this to update global function pointers, internal static variables, or dispatch tables.

◆ test_pattern

const char* CheckasmConfig::test_pattern

Pattern for filtering which tests to run.

Shell-style wildcard pattern (e.g., "video_*") to select tests. NULL means run all tests.

◆ tests

const CheckasmTest* CheckasmConfig::tests

Array of test functions to execute.

Array of test functions to execute, terminated by an entry with CheckasmTest.func == NULL (i.e. {0}.

◆ verbose

int CheckasmConfig::verbose

Enable verbose output.

When nonzero, prints detailed timing information, failure diagnostics, and extra terminal output (including table headers and extra information about the active configuration).


The documentation for this struct was generated from the following file: