Public Member Functions | Protected Attributes

BenchGroup< S > Class Template Reference

A group of benchmarks to run together. More...

#include <Benchmark.hpp>

List of all members.

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

Detailed Description

template<typename S>
class BenchGroup< S >

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.


Member Function Documentation

template<typename S >
void BenchGroup< S >::addBench ( Benchmark< S > *  bench ) [inline]

Add a benchmark to this benchmark group.

Parameters:
benchThe 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.

template<typename S >
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.

Parameters:
formatterThe formatter to use to output the results.
template<typename S >
void BenchGroup< S >::setMaxRuntime ( const double  d ) [inline]

The maximum runtime for the benchmarks of this group. default = unlimited.

Parameters:
dconst double.
Returns:
void

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.

template<typename S >
void BenchGroup< S >::setRepeats ( const unsigned  i ) [inline]

The number of times to repeat this benchmark. default = 5.

Parameters:
iThe number of times to repeat this benchmark.
template<typename S >
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.


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