unibench.h file
Register and time a list of benchmarks.
BENCHMARK adds a display name, tags, and a function to benchmark_ before main. run_ runs that list in registration order, prints each elapsed time in seconds, and returns the sum.
Classes
- struct BenchmarkNode
- One registered benchmark.
Functions
- static auto run_benchmarks(void) -> double
- Function to run all registered benchmarks.
Variables
- struct BenchmarkNode* benchmark_head
Defines
- #define BENCHMARK(name, tags)
- Register a benchmark and open its function body.
Function documentation
static double run_benchmarks(void)
Function to run all registered benchmarks.
| Returns | Returns the total seconds of all benchmarks summed up |
|---|
Define documentation
#define BENCHMARK(name, tags)
Register a benchmark and open its function body.
| Parameters | |
|---|---|
| name | Identifier used as the display name. |
| tags | String literal of filter tags. |
The next brace block is the benchmark. name is pasted into the function, so it must be an identifier.