CppBenchmark
1.0.4.0
C++ Benchmark Library
|
#include <settings.h>
Public Member Functions | |
Settings () | |
Initialize settings with the default benchmark duration (5 seconds) More... | |
Settings (int64_t operations) | |
Initialize settings with the given count of operations. More... | |
Settings (const Settings &)=default | |
Settings (Settings &&) noexcept=default | |
~Settings ()=default | |
Settings & | operator= (const Settings &)=default |
Settings & | operator= (Settings &&) noexcept=default |
int | attempts () const noexcept |
Get count of independent benchmark attempts. More... | |
bool | infinite () const noexcept |
Is benchmark running with infinite count of operations (until cancel)? More... | |
int64_t | duration () const noexcept |
Get benchmark duration in milliseconds. More... | |
int64_t | operations () const noexcept |
Get count of operations. More... | |
const std::vector< int > & | threads () const noexcept |
Get collection of independent threads counts in a benchmark plan. More... | |
const std::vector< std::tuple< int, int > > & | pc () const noexcept |
Get collection of independent producers/consumers counts in a benchmark plan. More... | |
const std::vector< std::tuple< int, int, int > > & | params () const noexcept |
Get collection of independent parameters in a benchmark plan. More... | |
const std::tuple< int64_t, int64_t, int > & | latency () const noexcept |
Get latency parameters. More... | |
bool | latency_auto () const noexcept |
Get automatic latency update flag. More... | |
Settings & | Attempts (int attempts) |
Set independent benchmark attempts. More... | |
Settings & | Infinite () |
Set infinite benchmark operations flag. More... | |
Settings & | Duration (int64_t duration) |
Set benchmark duration in seconds. More... | |
Settings & | Operations (int64_t operations) |
Set count of operations. More... | |
Settings & | Threads (int threads) |
Add new threads count to the benchmark running plan. More... | |
Settings & | ThreadsRange (int from, int to) |
Add new threads range to the benchmark running plan. More... | |
Settings & | ThreadsRange (int from, int to, const std::function< int(int, int, int &)> &selector) |
Add new threads range to the benchmark running plan using given selector function. More... | |
Settings & | PC (int producers, int consumers) |
Add new producers/consumers count to the benchmark running plan. More... | |
Settings & | PCRange (int producers_from, int producers_to, int consumers_from, int consumers_to) |
Add new producers/consumers range to the benchmark running plan. More... | |
Settings & | PCRange (int producers_from, int producers_to, const std::function< int(int, int, int &)> &producers_selector, int consumers_from, int consumers_to, const std::function< int(int, int, int &)> &consumers_selector) |
Add new producers/consumers range to the benchmark running plan using given selector functions. More... | |
Settings & | Param (int value) |
Add new single parameter to the benchmark running plan. More... | |
Settings & | ParamRange (int from, int to) |
Add new single parameter range to the benchmark running plan. More... | |
Settings & | ParamRange (int from, int to, const std::function< int(int, int, int &)> &selector) |
Add new single parameter range to the benchmark running plan using given selector function. More... | |
Settings & | Pair (int value1, int value2) |
Add new parameters pair to the benchmark running plan. More... | |
Settings & | PairRange (int from1, int to1, int from2, int to2) |
Add new parameters pairs range to the benchmark running plan. More... | |
Settings & | PairRange (int from1, int to1, const std::function< int(int, int, int &)> &selector1, int from2, int to2, const std::function< int(int, int, int &)> &selector2) |
Add new parameters pairs range to the benchmark running plan using given selector functions. More... | |
Settings & | Triple (int value1, int value2, int value3) |
Add new parameters triple to the benchmark running plan. More... | |
Settings & | TripleRange (int from1, int to1, int from2, int to2, int from3, int to3) |
Add new parameters triple range to the benchmark running plan. More... | |
Settings & | TripleRange (int from1, int to1, const std::function< int(int, int, int &)> &selector1, int from2, int to2, const std::function< int(int, int, int &)> &selector2, int from3, int to3, const std::function< int(int, int, int &)> &selector3) |
Add new parameters triple range to the benchmark running plan using given selector functions. More... | |
Settings & | Latency (int64_t lowest, int64_t highest, int significant, bool automatic=true) |
Set latency histogram parameters. More... | |
Friends | |
class | Benchmark |
class | BenchmarkPC |
class | BenchmarkThreads |
Benchmark settings.
Provides interface to all benchmark settings:
All settings can be configured using fluent syntax.
Definition at line 31 of file settings.h.
CppBenchmark::Settings::Settings | ( | ) |
Initialize settings with the default benchmark duration (5 seconds)
Definition at line 13 of file settings.cpp.
CppBenchmark::Settings::Settings | ( | int64_t | operations | ) |
Initialize settings with the given count of operations.
operations | - Count of operations |
Definition at line 24 of file settings.cpp.
|
default |
|
defaultnoexcept |
|
default |
|
inlinenoexcept |
Get count of independent benchmark attempts.
Definition at line 53 of file settings.h.
Settings & CppBenchmark::Settings::Attempts | ( | int | attempts | ) |
Set independent benchmark attempts.
Benchmark will be launched in several independent attempts. Best attempt with the lowest total execution time will be chosen as result one.
attempts | - Independent benchmark attempts (must be positive) |
Definition at line 30 of file settings.cpp.
|
inlinenoexcept |
Get benchmark duration in milliseconds.
Definition at line 57 of file settings.h.
Settings & CppBenchmark::Settings::Duration | ( | int64_t | duration | ) |
Set benchmark duration in seconds.
duration | - Benchmark duration in seconds (must be positive) |
Definition at line 52 of file settings.cpp.
Settings & CppBenchmark::Settings::Infinite | ( | ) |
Set infinite benchmark operations flag.
Benchmark will be launched in infinite operations loop until Context.Cancel() method is called.
Definition at line 36 of file settings.cpp.
|
inlinenoexcept |
Is benchmark running with infinite count of operations (until cancel)?
Definition at line 55 of file settings.h.
|
inlinenoexcept |
Get latency parameters.
Definition at line 67 of file settings.h.
Settings & CppBenchmark::Settings::Latency | ( | int64_t | lowest, |
int64_t | highest, | ||
int | significant, | ||
bool | automatic = true |
||
) |
Set latency histogram parameters.
lowest | - The smallest possible value to be put into the histogram |
highest | - The largest possible value to be put into the histogram |
significant | - Number of significant figures |
automatic | - Automatic latency update (default is true) |
Definition at line 333 of file settings.cpp.
|
inlinenoexcept |
Get automatic latency update flag.
Definition at line 69 of file settings.h.
|
inlinenoexcept |
Get count of operations.
Definition at line 59 of file settings.h.
Settings & CppBenchmark::Settings::Operations | ( | int64_t | operations | ) |
Set count of operations.
operations | - Count of operations (must be positive) |
Definition at line 44 of file settings.cpp.
Settings & CppBenchmark::Settings::Pair | ( | int | value1, |
int | value2 | ||
) |
Add new parameters pair to the benchmark running plan.
value1 | - First parameter (must be positive) |
value2 | - Second parameter (must be positive) |
Definition at line 200 of file settings.cpp.
Settings & CppBenchmark::Settings::PairRange | ( | int | from1, |
int | to1, | ||
const std::function< int(int, int, int &)> & | selector1, | ||
int | from2, | ||
int | to2, | ||
const std::function< int(int, int, int &)> & | selector2 | ||
) |
Add new parameters pairs range to the benchmark running plan using given selector functions.
This method will call selector functions with from1 / from2, to1 / to2 and current arguments. Each selector function may change current argument and return result value. If result value is bounds to xxx_from - xxx_to range it will be add to the benchmark running plan. Otherwise selecting process will stop.
from1 | - From range of the first parameter (must be positive) |
to1 | - To range of the first parameter (must be positive) |
selector1 | - Selector function for the first parameter |
from2 | - From range of the second parameter (must be positive) |
to2 | - To range of the second parameter (must be positive) |
selector2 | - Selector function for the second parameter |
Definition at line 224 of file settings.cpp.
Settings & CppBenchmark::Settings::PairRange | ( | int | from1, |
int | to1, | ||
int | from2, | ||
int | to2 | ||
) |
Add new parameters pairs range to the benchmark running plan.
This method will iterate from1, from2 - to1, to2 and add each parameters pair to the benchmark running plan.
from1 | - From range of the first parameter (must be positive) |
to1 | - To range of the first parameter (must be positive) |
from2 | - From range of the second parameter (must be positive) |
to2 | - To range of the second parameter (must be positive) |
Definition at line 207 of file settings.cpp.
Settings & CppBenchmark::Settings::Param | ( | int | value | ) |
Add new single parameter to the benchmark running plan.
value | - Single parameter (must be positive) |
Definition at line 159 of file settings.cpp.
Settings & CppBenchmark::Settings::ParamRange | ( | int | from, |
int | to | ||
) |
Add new single parameter range to the benchmark running plan.
This method will iterate from - to and add each single parameter value to the benchmark running plan.
from | - From range of the single parameter (must be positive) |
to | - To range of the single parameter (must be positive) |
Definition at line 166 of file settings.cpp.
Settings & CppBenchmark::Settings::ParamRange | ( | int | from, |
int | to, | ||
const std::function< int(int, int, int &)> & | selector | ||
) |
Add new single parameter range to the benchmark running plan using given selector function.
This method will call selector function with from, to and current argument. Selector function may change current argument and return result value. If result value is bounds to from to range it will be add to the benchmark running plan. Otherwise selecting process will stop.
from | - From range of the single parameter (must be positive) |
to | - To range of the single parameter (must be positive) |
selector | - Selector function |
Definition at line 179 of file settings.cpp.
|
inlinenoexcept |
Get collection of independent parameters in a benchmark plan.
Definition at line 65 of file settings.h.
|
inlinenoexcept |
Get collection of independent producers/consumers counts in a benchmark plan.
Definition at line 63 of file settings.h.
Settings & CppBenchmark::Settings::PC | ( | int | producers, |
int | consumers | ||
) |
Add new producers/consumers count to the benchmark running plan.
producers | - Count of producers (must be positive) |
consumers | - Count of consumers (must be positive) |
Definition at line 101 of file settings.cpp.
Settings & CppBenchmark::Settings::PCRange | ( | int | producers_from, |
int | producers_to, | ||
const std::function< int(int, int, int &)> & | producers_selector, | ||
int | consumers_from, | ||
int | consumers_to, | ||
const std::function< int(int, int, int &)> & | consumers_selector | ||
) |
Add new producers/consumers range to the benchmark running plan using given selector functions.
This method will call selector functions with producers_from / consumers_from, producers_to / consumers_to and current arguments. Each selector function may change current argument and return result value. If result value is bounds to xxx_from - xxx_to range it will be add to the benchmark running plan. Otherwise selecting process will stop.
producers_from | - From range of producers (must be positive) |
producers_to | - To range of producers (must be positive) |
producers_selector | - Producers selector function |
consumers_from | - From range of consumers (must be positive) |
consumers_to | - To range of consumers (must be positive) |
consumers_selector | - Consumers selector function |
Definition at line 125 of file settings.cpp.
Settings & CppBenchmark::Settings::PCRange | ( | int | producers_from, |
int | producers_to, | ||
int | consumers_from, | ||
int | consumers_to | ||
) |
Add new producers/consumers range to the benchmark running plan.
This method will iterate producers_from, consumers_from - producers_to, consumers_to and add each producers/consumers pair to the benchmark running plan.
producers_from | - From range of producers (must be positive) |
producers_to | - To range of producers (must be positive) |
consumers_from | - From range of consumers (must be positive) |
consumers_to | - To range of consumers (must be positive) |
Definition at line 108 of file settings.cpp.
|
inlinenoexcept |
Get collection of independent threads counts in a benchmark plan.
Definition at line 61 of file settings.h.
Settings & CppBenchmark::Settings::Threads | ( | int | threads | ) |
Add new threads count to the benchmark running plan.
threads | - Count of running threads (must be positive) |
Definition at line 60 of file settings.cpp.
Settings & CppBenchmark::Settings::ThreadsRange | ( | int | from, |
int | to | ||
) |
Add new threads range to the benchmark running plan.
This method will iterate from - to and add each threads value to the benchmark running plan.
from | - From range of running threads (must be positive) |
to | - To range of running threads (must be positive) |
Definition at line 67 of file settings.cpp.
Settings & CppBenchmark::Settings::ThreadsRange | ( | int | from, |
int | to, | ||
const std::function< int(int, int, int &)> & | selector | ||
) |
Add new threads range to the benchmark running plan using given selector function.
This method will call selector function with from, to and current argument. Selector function may change current argument and return result value. If result value is bounds to from to range it will be add to the benchmark running plan. Otherwise selecting process will stop.
from | - From range of running threads (must be positive) |
to | - To range of running threads (must be positive) |
selector | - Selector function |
Definition at line 80 of file settings.cpp.
Settings & CppBenchmark::Settings::Triple | ( | int | value1, |
int | value2, | ||
int | value3 | ||
) |
Add new parameters triple to the benchmark running plan.
value1 | - First parameter (must be positive) |
value2 | - Second parameter (must be positive) |
value3 | - Third parameter (must be positive) |
Definition at line 258 of file settings.cpp.
Settings & CppBenchmark::Settings::TripleRange | ( | int | from1, |
int | to1, | ||
const std::function< int(int, int, int &)> & | selector1, | ||
int | from2, | ||
int | to2, | ||
const std::function< int(int, int, int &)> & | selector2, | ||
int | from3, | ||
int | to3, | ||
const std::function< int(int, int, int &)> & | selector3 | ||
) |
Add new parameters triple range to the benchmark running plan using given selector functions.
This method will call selector functions with from1 / from2 / from3, to1 / to2 / to3 and current arguments. Each selector function may change current argument and return result value. If result value is bounds to xxx_from - xxx_to range it will be add to the benchmark running plan. Otherwise selecting process will stop.
from1 | - From range of the first parameter (must be positive) |
to1 | - To range of the first parameter (must be positive) |
selector1 | - Selector function for the first parameter |
from2 | - From range of the second parameter (must be positive) |
to2 | - To range of the second parameter (must be positive) |
selector2 | - Selector function for the second parameter |
from3 | - From range of the third parameter (must be positive) |
to3 | - To range of the third parameter (must be positive) |
selector3 | - Selector function for the third parameter |
Definition at line 286 of file settings.cpp.
Settings & CppBenchmark::Settings::TripleRange | ( | int | from1, |
int | to1, | ||
int | from2, | ||
int | to2, | ||
int | from3, | ||
int | to3 | ||
) |
Add new parameters triple range to the benchmark running plan.
This method will iterate from1, from2, from3 - to1, to2, to3 and add each parameters triple to the benchmark running plan.
from1 | - From range of the first parameter (must be positive) |
to1 | - To range of the first parameter (must be positive) |
from2 | - From range of the second parameter (must be positive) |
to2 | - To range of the second parameter (must be positive) |
from3 | - From range of the third parameter (must be positive) |
to3 | - To range of the third parameter (must be positive) |
Definition at line 265 of file settings.cpp.
|
friend |
Definition at line 33 of file settings.h.
|
friend |
Definition at line 34 of file settings.h.
|
friend |
Definition at line 35 of file settings.h.