cpp-stat-bench 0.24.0
Benchmark library with statistics for C++.
Loading...
Searching...
No Matches
measurement_config.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2025 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 */
21
22#include <utility>
23
25
26namespace stat_bench {
27
28MeasurementConfig::MeasurementConfig() : type_("Unnamed Measurement") {}
29
30auto MeasurementConfig::type(std::string value) -> MeasurementConfig& {
31 type_ = measurer::MeasurementType(std::move(value));
32 return *this;
33}
34
35auto MeasurementConfig::samples(std::size_t value) -> MeasurementConfig& {
36 samples_ = value;
37 return *this;
38}
39
42 warming_up_samples_ = value;
43 return *this;
44}
45
47 iterations_ = value;
48 return *this;
49}
50
51auto MeasurementConfig::type() const noexcept
52 -> const measurer::MeasurementType& {
53 return type_;
54}
55
56auto MeasurementConfig::samples() const noexcept -> std::optional<std::size_t> {
57 return samples_;
58}
59
61 -> std::optional<std::size_t> {
62 return warming_up_samples_;
63}
64
65auto MeasurementConfig::iterations() const noexcept
66 -> std::optional<std::size_t> {
67 return iterations_;
68}
69
70} // namespace stat_bench
auto warming_up_samples() const noexcept -> std::optional< std::size_t >
Get the number of samples for warming up.
auto iterations() const noexcept -> std::optional< std::size_t >
Get the number of iterations.
auto type() const noexcept -> const measurer::MeasurementType &
Get the measurement type.
auto samples() const noexcept -> std::optional< std::size_t >
Get the number of samples (except for warming up).
Class of names of measurement types.
Definition of MeasurementConfig class.
Definition of MeasurementType class.
Namespace of classes to measure time in benchmarks.
Namespace of stat_bench source codes.
STL namespace.