cpp-stat-bench 0.24.0
Benchmark library with statistics for C++.
Loading...
Searching...
No Matches
mean_processing_time_measurer.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 <string>
24
27
28namespace stat_bench {
29namespace measurer {
30
34class MeanProcessingTimeMeasurer final : public IMeasurer {
35public:
46 MeanProcessingTimeMeasurer(double min_sample_duration_sec,
47 std::size_t samples, std::size_t min_warming_up_iterations,
48 double min_warming_up_duration_sec)
49 : min_sample_duration_sec_(min_sample_duration_sec),
50 samples_(samples),
51 min_warming_up_iterations_(min_warming_up_iterations),
52 min_warming_up_duration_sec_(min_warming_up_duration_sec) {}
53
55 [[nodiscard]] auto name() const noexcept -> const MeasurerName& override {
56 return name_;
57 }
58
60 [[nodiscard]] auto measure(bench_impl::IBenchmarkCase* bench_case,
61 const BenchmarkCondition& cond) const -> Measurement override;
62
65 auto operator=(const MeanProcessingTimeMeasurer&)
66 -> MeanProcessingTimeMeasurer& = delete;
67 auto operator=(MeanProcessingTimeMeasurer&&)
68 -> MeanProcessingTimeMeasurer& = delete;
69
73 ~MeanProcessingTimeMeasurer() override = default;
74
75private:
77 const MeasurerName name_{"Mean Processing Time"};
78
80 double min_sample_duration_sec_;
81
83 std::size_t samples_;
84
86 std::size_t min_warming_up_iterations_;
87
89 double min_warming_up_duration_sec_;
90};
91
92} // namespace measurer
93} // namespace stat_bench
Class of conditions of benchmarks.
Interface of cases in benchmarks.
auto measure(bench_impl::IBenchmarkCase *bench_case, const BenchmarkCondition &cond) const -> Measurement override
Measure durations.
auto name() const noexcept -> const MeasurerName &override
Get the name of this measurer.
MeanProcessingTimeMeasurer(double min_sample_duration_sec, std::size_t samples, std::size_t min_warming_up_iterations, double min_warming_up_duration_sec)
Constructor.
~MeanProcessingTimeMeasurer() override=default
Destructor.
Class of data of measurements.
Definition measurement.h:42
Class of names of measurers.
Definition of IMeasurer class.
Definition of MeasurerName class.
Namespace of classes to measure time in benchmarks.
Namespace of stat_bench source codes.