A group of benchmarks to run together. More...
#include <Benchmark.hpp>
Public Member Functions | |
void | addBench (Benchmark< S > *bench) |
Add a benchmark to this benchmark group. | |
void | addVal (const S val) |
void | setMaxRuntime (const double d) |
The maximum runtime for the benchmarks of this group. default = unlimited. | |
double | getMaxRuntime () const |
void | setRepeats (const unsigned i) |
The number of times to repeat this benchmark. default = 5. | |
unsigned | getRepeats () const |
void | setWarmup (const unsigned i) |
The number of warmup runs to do. default = 0. | |
unsigned | getWarmup () const |
void | run (BenchFormatter &formatter) const |
Run all benchmarks in this group with the given values. | |
Protected Attributes | |
double | mMaxRuntime |
unsigned | mRepeats |
unsigned | mWarmup |
std::vector< Benchmark< S > * > | mBenches |
std::vector< S > | mVals |
A group of benchmarks to run together.
They should generally be comparable to one another. This is partially enforced by each benchmark being called with the same value.
void BenchGroup< S >::addBench | ( | Benchmark< S > * | bench ) | [inline] |
Add a benchmark to this benchmark group.
bench | The memory for the benchmarks added to a BenchGroup is cleaned up by the BenchGroup upon destruction. |
Benchmarks are run in the order they are added to this function.
void BenchGroup< S >::run | ( | BenchFormatter & | formatter ) | const |
Run all benchmarks in this group with the given values.
This will run the benchmarks in the order they were added to the BenchGroup. It will run each benchmark for the current value before moving on to the next value.
formatter | The formatter to use to output the results. |
void BenchGroup< S >::setMaxRuntime | ( | const double | d ) | [inline] |
The maximum runtime for the benchmarks of this group. default = unlimited.
d | const double. |
Some benchmarks take a long time to run. After a certain point you may not be getting any more information from running that benchmark. When set if a benchmark of a given value takes longer than MaxRuntime, that benchmark will not be run for future values.
void BenchGroup< S >::setRepeats | ( | const unsigned | i ) | [inline] |
The number of times to repeat this benchmark. default = 5.
i | The number of times to repeat this benchmark. |
void BenchGroup< S >::setWarmup | ( | const unsigned | i ) | [inline] |
The number of warmup runs to do. default = 0.
Sometimes it's a good idea to run a benchmark a few times before starting to record results. Warmup runs do not count towards a benchmark's runtime.