51 std::size_t
samples, std::size_t warming_up_samples)
52 : cond_(
std::move(cond)),
55 warming_up_samples_(warming_up_samples) {}
72 [[nodiscard]]
auto threads() const noexcept ->
std::
size_t {
73 return cond_.threads();
90 [[nodiscard]]
auto samples() const noexcept ->
std::
size_t {
101 template <
typename T>
104 return cond_.params().get<T>(param_name);
114 template <
typename T>
115 [[nodiscard]]
auto get_param(std::string param_name)
const ->
const T& {
129 -> std::shared_ptr<stat::CustomStatOutput> {
131 std::make_shared<stat::CustomStatOutput>(name, cond_.threads(),
132 samples_, warming_up_samples_, iterations_, analysis_type);
133 custom_stat_outputs_.push_back(out);
147 -> std::shared_ptr<stat::CustomStatOutput> {
159 custom_outputs_.emplace_back(name, value);
178 template <
typename Func>
181 cond_.threads(), iterations_, samples_, warming_up_samples_)
193 -> const
std::vector<
std::vector<
clock::Duration>>& {
203 -> const
std::vector<
std::shared_ptr<
stat::CustomStatOutput>>& {
204 return custom_stat_outputs_;
214 return custom_outputs_;
222 std::size_t iterations_;
225 std::size_t samples_;
228 std::size_t warming_up_samples_;
231 std::vector<std::vector<clock::Duration>> durations_{};
234 std::vector<std::shared_ptr<stat::CustomStatOutput>> custom_stat_outputs_{};
237 std::vector<std::pair<CustomOutputName, double>> custom_outputs_{};
Definition of BenchmarkCondition class.
Class of conditions of benchmarks.
Class of names of custom outputs.
Class of context of invocations of benchmarks.
auto add_custom_stat(std::string name, stat::CustomOutputAnalysisType analysis_type=stat::CustomOutputAnalysisType::mean) -> std::shared_ptr< stat::CustomStatOutput >
Add a custom output with statistics.
auto custom_outputs() const noexcept -> const std::vector< std::pair< CustomOutputName, double > > &
Get the custom outputs without statistics.
auto durations() const noexcept -> const std::vector< std::vector< clock::Duration > > &
Get the measured durations.
auto samples() const noexcept -> std::size_t
Get the number of samples.
void measure(const Func &func)
Measure time.
auto get_param(std::string param_name) const -> const T &
Get a parameter.
auto add_custom_stat(const CustomOutputName &name, stat::CustomOutputAnalysisType analysis_type=stat::CustomOutputAnalysisType::mean) -> std::shared_ptr< stat::CustomStatOutput >
Add a custom output with statistics.
auto custom_stat_outputs() const noexcept -> const std::vector< std::shared_ptr< stat::CustomStatOutput > > &
Get the custom outputs with statistics.
void add_custom_output(std::string name, double value)
Add a custom output without statistics.
InvocationContext(BenchmarkCondition cond, std::size_t iterations, std::size_t samples, std::size_t warming_up_samples)
Constructor.
auto threads() const noexcept -> std::size_t
Get the number of threads.
~InvocationContext()=default
Destructor.
void add_custom_output(const CustomOutputName &name, double value)
Add a custom output without statistics.
auto iterations() const noexcept -> std::size_t
Get the number of iterations.
auto get_param(const param::ParameterName ¶m_name) const -> const T &
Get a parameter.
Class to invoke functions measuring durations in threads if needed.
auto measure(const Func &func) const -> std::vector< std::vector< clock::Duration > >
Measure time.
Class of names of parameters.
Definition of CustomOutputName class.
Definition of CustomStatOutput class.
Definition of Duration class.
Namespace of clocks for benchmarks.
CustomOutputAnalysisType
Enumeration of types of analysis applied to custom outputs.
Namespace of stat_bench source codes.
Definition of ParameterName class.
Definition of ThreadableInvoker class.