cpp-stat-bench 0.24.0
Benchmark library with statistics for C++.
Loading...
Searching...
No Matches
benchmark_condition.h
Go to the documentation of this file.
1/*
2 * Copyright 2021 MusicScience37 (Kenta Kabashima)
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
20#pragma once
21
22#include <cstddef>
23#include <utility>
24
27
28namespace stat_bench {
29
34public:
42 : threads_(threads), params_(std::move(params)) {}
43
51
57 [[nodiscard]] auto threads() const noexcept -> std::size_t {
58 return threads_;
59 }
60
66 [[nodiscard]] auto params() const noexcept -> const param::ParameterDict& {
67 return params_;
68 }
69
70private:
77 [[nodiscard]] static auto get_threads(const param::ParameterDict& params)
78 -> std::size_t {
80 return params.get<std::size_t>(param::num_threads_parameter_name());
81 }
82 return static_cast<std::size_t>(1);
83 }
84
86 std::size_t threads_;
87
89 param::ParameterDict params_;
90};
91
92} // namespace stat_bench
auto threads() const noexcept -> std::size_t
Get the number of threads.
BenchmarkCondition(std::size_t threads, param::ParameterDict params)
Constructor.
auto params() const noexcept -> const param::ParameterDict &
Get the parameters.
BenchmarkCondition(const param::ParameterDict &params)
Constructor.
Class of dictionaries of parameters.
Namespace of parameters of benchmarks.
auto num_threads_parameter_name() -> const ParameterName &
Get the parameter name for the number of threads.
Namespace of stat_bench source codes.
STL namespace.
Definition of num_threads_parameter_name function.
Definition of ParameterDict class.