Chebyshev
Unit testing for scientific software
Loading...
Searching...
No Matches
benchmark_structures.h
Go to the documentation of this file.
1
5
6#ifndef CHEBYSHEV_BENCHMARK_STRUCTURES_H
7#define CHEBYSHEV_BENCHMARK_STRUCTURES_H
8
9#include <functional>
10#include <map>
11
12#include "../core/common.h"
13#include "./generator.h"
14
15
16namespace chebyshev {
17
18 namespace benchmark {
19
20
24
26 std::string name = "unknown";
27
29 unsigned int runs = 0;
30
32 unsigned int iterations = 0;
33
36
39
42
45
48
51 bool failed = true;
52
54 bool quiet = false;
55
57 std::map<std::string, long double> additionalFields {};
58
59 };
60
61
64 template<typename InputType>
66
67
70 template<typename InputType = double>
72
75
78
81
83 bool quiet = false;
84
88
89
92
95 benchmark_options(unsigned int runs, unsigned int iterations, bool quiet = false)
97
101 unsigned int runs,
102 unsigned int iterations,
104 bool quiet = false)
106
107 };
108
109 }
110}
111
112#endif
#define CHEBYSHEV_BENCHMARK_ITER
Default number of benchmark iterations.
Definition common.h:22
#define CHEBYSHEV_BENCHMARK_RUNS
Default number of benchmark runs.
Definition common.h:27
Input generators for benchmarks.
auto uniform1D(long double a, long double b)
Uniform generator over a domain.
Definition generator.h:26
std::function< InputType(random::random_source &)> InputGenerator
A function which takes in a random source and returns a generated input element.
Definition benchmark_structures.h:65
General namespace of the framework.
Definition benchmark.h:22
constexpr FloatType get_nan()
Get a quiet NaN of the specified floating point type.
Definition common.h:65
A structure holding the options of a benchmark.
Definition benchmark_structures.h:71
benchmark_options(unsigned int runs, unsigned int iterations, bool quiet=false)
Construct benchmark options from the number of runs and iterations and whether to print the case to o...
Definition benchmark_structures.h:95
unsigned int iterations
Number of iterations.
Definition benchmark_structures.h:77
uint64_t seed
The seed to use for randomized input generation (by default, a random seed is generated using the ran...
Definition benchmark_structures.h:87
bool quiet
Whether to print to standard output or not.
Definition benchmark_structures.h:83
benchmark_options()
Default constructor for benchmark options.
Definition benchmark_structures.h:91
unsigned int runs
Number of runs (run with the same input values).
Definition benchmark_structures.h:74
InputGenerator< InputType > inputGenerator
The function to use to generate input for the benchmark.
Definition benchmark_structures.h:80
benchmark_options(unsigned int runs, unsigned int iterations, InputGenerator< InputType > gen, bool quiet=false)
Construct benchmark options from the number of runs and iterations, the input generator to use and wh...
Definition benchmark_structures.h:100
Structure holding the results of a benchmark.
Definition benchmark_structures.h:23
bool quiet
Whether to print to standard output or not.
Definition benchmark_structures.h:54
long double averageRuntime
Estimated average runtime.
Definition benchmark_structures.h:38
bool failed
Whether the benchmark failed because an exception was thrown.
Definition benchmark_structures.h:51
unsigned int runs
Number of runs.
Definition benchmark_structures.h:29
unsigned int iterations
Number of iterations.
Definition benchmark_structures.h:32
long double runsPerSecond
Number of runs per second.
Definition benchmark_structures.h:44
long double totalRuntime
Total runtime over all runs and iterations.
Definition benchmark_structures.h:35
uint64_t seed
The seed used for randomized input generation.
Definition benchmark_structures.h:47
std::string name
Identifying name of the function or test case.
Definition benchmark_structures.h:26
std::map< std::string, long double > additionalFields
Additional fields in floating point representation.
Definition benchmark_structures.h:57
long double stdevRuntime
Sample standard deviation of the runtime.
Definition benchmark_structures.h:41
A source of pseudorandom numbers.
Definition random.h:39