Chebyshev
Unit testing for scientific software
|
Benchmark module. More...
Namespaces | |
namespace | generator |
Input generators for benchmarks. | |
Classes | |
class | benchmark_context |
Benchmark module context, handling benchmark requests concurrently. More... | |
class | benchmark_options |
A structure holding the options of a benchmark. More... | |
class | benchmark_result |
Structure holding the results of a benchmark. More... | |
class | benchmark_settings |
Global settings of the benchmark module, used in benchmark_context. More... | |
class | timer |
Timer class to measure elapsed time in milliseconds. More... | |
Typedefs | |
template<typename InputType > | |
using | InputGenerator = std::function< InputType(random::random_source &)> |
A function which takes in a random source and returns a generated input element. | |
Functions | |
template<typename InputType , typename Function > | |
long double | runtime (Function func, const std::vector< InputType > &input) |
Measure the total runtime of a function over the given input for a single run. | |
benchmark_context | make_context (const std::string &moduleName, int argc=0, const char **argv=nullptr) |
Construct a benchmarking context with the given parameters. | |
Benchmark module.
This module provides routines for measuring the average runtime of functions of any kind over a randomized or fixed vector of inputs. The benchmark::benchmark implements this functionality and registers the results for analysis and output.
benchmark_context chebyshev::benchmark::make_context | ( | const std::string & | moduleName, |
int | argc = 0 , |
||
const char ** | argv = nullptr |
||
) |
Construct a benchmarking context with the given parameters.
moduleName | Name of the module under test. |
argc | The number of command line arguments. |
argv | An array of command line arguments as C-like strings. |
|
inline |
Measure the total runtime of a function over the given input for a single run.
It is generally not needed to call this function directly, as benchmarks can be run and registered using benchmark::benchmark.
func | The function to measure the runtime of |
input | The vector of inputs |