Framework for running simple runtime benchmarks.
More...
Framework for running simple runtime benchmarks.
|
file | benchmark.h |
| Interface for running simple benchmarks.
|
|
|
void | benchmark_print_time (uint32_t time, unsigned long runs, const char *name) |
| Output the given time as well as the time per run on STDIO. More...
|
|
◆ BENCHMARK_FUNC
#define BENCHMARK_FUNC |
( |
|
name, |
|
|
|
runs, |
|
|
|
func |
|
) |
| |
Value: { \
for (unsigned long i = 0; i < runs; i++) { \
func; \
} \
benchmark_print_time(_benchmark_time, runs,
name); \
}
Measure the runtime of a given function call.
As we are doing a time sensitive measurement here, there is no way around using a preprocessor function, as going with a function pointer or similar would influence the measured runtime...
- Parameters
-
[in] | name | name for labeling the output |
[in] | runs | number of times to run func |
[in] | func | function call to benchmark |
Definition at line 44 of file benchmark.h.
◆ benchmark_print_time()
void benchmark_print_time |
( |
uint32_t |
time, |
|
|
unsigned long |
runs, |
|
|
const char * |
name |
|
) |
| |
Output the given time as well as the time per run on STDIO.
- Parameters
-
[in] | time | overall runtime in us |
[in] | runs | number of runs |
[in] | name | name to label the output |