Zephyr API Documentation 4.4.0-rc1
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
Zephyr Benchmarking Framework

Macros

#define ZTEST_BENCHMARK_SUITE(suite, setup_fn, teardown_fn)
 Define a benchmark suite.
#define ZTEST_BENCHMARK_SETUP_TEARDOWN(suite_name, benchmark, samples, setup_fn, teardown_fn)
 Define a benchmark with setup and teardown functions.
#define ZTEST_BENCHMARK_TIMED_SETUP_TEARDOWN(testsuite, benchmark, duration, setup_fn, teardown_fn)
 Define a timed benchmark with setup and teardown functions.
#define ZTEST_BENCHMARK(suite, benchmark, samples)
 Define a benchmark without setup and teardown functions.
#define ZTEST_BENCHMARK_TIMED(suite, benchmark, duration)
 Define a timed benchmark without setup and teardown functions.

Detailed Description

Macro Definition Documentation

◆ ZTEST_BENCHMARK

#define ZTEST_BENCHMARK ( suite,
benchmark,
samples )

#include </__w/zephyr/zephyr/subsys/testsuite/ztest/include/zephyr/benchmark.h>

Value:
ZTEST_BENCHMARK_SETUP_TEARDOWN(suite, benchmark, samples, NULL, NULL)
#define ZTEST_BENCHMARK_SETUP_TEARDOWN(suite_name, benchmark, samples, setup_fn, teardown_fn)
Define a benchmark with setup and teardown functions.
Definition benchmark.h:97
#define NULL
Definition iar_missing_defs.h:20

Define a benchmark without setup and teardown functions.

Parameters
suiteName of the suite the benchmark belongs to
benchmarkName of the benchmark
samplesNumber of iterations to run the benchmark

◆ ZTEST_BENCHMARK_SETUP_TEARDOWN

#define ZTEST_BENCHMARK_SETUP_TEARDOWN ( suite_name,
benchmark,
samples,
setup_fn,
teardown_fn )

#include </__w/zephyr/zephyr/subsys/testsuite/ztest/include/zephyr/benchmark.h>

Value:
static __noinline void benchmark##_fn(void); \
static const STRUCT_SECTION_ITERABLE(ztest_benchmark, benchmark) = \
{ \
.name = #benchmark, \
.iterations = samples, \
.setup = setup_fn, \
.run = benchmark##_fn, \
.teardown = teardown_fn, \
.suite = &suite_name, \
}; \
static __noinline void benchmark##_fn(void)
#define STRUCT_SECTION_ITERABLE(struct_type, varname)
Defines a new element for an iterable section.
Definition iterable_sections.h:216

Define a benchmark with setup and teardown functions.

Parameters
suite_nameName of the suite the benchmark belongs to
benchmarkName of the benchmark
samplesNumber of iterations to run the benchmark
setup_fnFunction to run before the benchmark
teardown_fnFunction to run after the benchmark

◆ ZTEST_BENCHMARK_SUITE

#define ZTEST_BENCHMARK_SUITE ( suite,
setup_fn,
teardown_fn )

#include </__w/zephyr/zephyr/subsys/testsuite/ztest/include/zephyr/benchmark.h>

Value:
static const STRUCT_SECTION_ITERABLE(ztest_benchmark_suite, suite) = \
{ \
.name = #suite, \
.setup = setup_fn, \
.teardown = teardown_fn, \
}

Define a benchmark suite.

Parameters
suiteName of the suite
setup_fnFunction to run before the suite
teardown_fnFunction to run after the suite

◆ ZTEST_BENCHMARK_TIMED

#define ZTEST_BENCHMARK_TIMED ( suite,
benchmark,
duration )

#include </__w/zephyr/zephyr/subsys/testsuite/ztest/include/zephyr/benchmark.h>

Value:
ZTEST_BENCHMARK_TIMED_SETUP_TEARDOWN(suite, benchmark, duration, NULL, NULL)
#define ZTEST_BENCHMARK_TIMED_SETUP_TEARDOWN(testsuite, benchmark, duration, setup_fn, teardown_fn)
Define a timed benchmark with setup and teardown functions.
Definition benchmark.h:120

Define a timed benchmark without setup and teardown functions.

Parameters
suiteName of the suite the benchmark belongs to
benchmarkName of the benchmark
durationDuration in milliseconds to run the benchmark

◆ ZTEST_BENCHMARK_TIMED_SETUP_TEARDOWN

#define ZTEST_BENCHMARK_TIMED_SETUP_TEARDOWN ( testsuite,
benchmark,
duration,
setup_fn,
teardown_fn )

#include </__w/zephyr/zephyr/subsys/testsuite/ztest/include/zephyr/benchmark.h>

Value:
static __noinline void benchmark##_fn(void); \
static const STRUCT_SECTION_ITERABLE(ztest_benchmark_timed, benchmark) = \
{ \
.name = #benchmark, \
.duration_ms = duration, \
.setup = setup_fn, \
.run = benchmark##_fn, \
.teardown = teardown_fn, \
.suite = &testsuite, \
}; \
static __noinline void benchmark##_fn(void)

Define a timed benchmark with setup and teardown functions.

Parameters
testsuiteName of the suite the benchmark belongs to
benchmarkName of the benchmark
durationDuration in milliseconds to run the benchmark
setup_fnFunction to run before the benchmark
teardown_fnFunction to run after the benchmark