cpp-stat-bench 0.24.0
Benchmark library with statistics for C++.
Loading...
Searching...
No Matches
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 ProcessingTimeMeasurer final : public IMeasurer {
35public:
45 ProcessingTimeMeasurer(std::size_t samples,
46 std::size_t min_warming_up_iterations,
47 double min_warming_up_duration_sec)
48 : samples_(samples),
49 min_warming_up_iterations_(min_warming_up_iterations),
50 min_warming_up_duration_sec_(min_warming_up_duration_sec) {}
51
53 [[nodiscard]] auto name() const noexcept -> const MeasurerName& override {
54 return name_;
55 }
56
58 [[nodiscard]] auto measure(bench_impl::IBenchmarkCase* bench_case,
59 const BenchmarkCondition& cond) const -> Measurement override;
60
63 auto operator=(const ProcessingTimeMeasurer&)
64 -> ProcessingTimeMeasurer& = delete;
65 auto operator=(ProcessingTimeMeasurer&&)
66 -> ProcessingTimeMeasurer& = delete;
67
71 ~ProcessingTimeMeasurer() override = default;
72
73private:
75 const MeasurerName name_{"Processing Time"};
76
78 std::size_t samples_;
79
81 std::size_t min_warming_up_iterations_;
82
84 double min_warming_up_duration_sec_;
85};
86
87} // namespace measurer
88} // namespace stat_bench
Class of conditions of benchmarks.
Interface of cases in benchmarks.
Class of data of measurements.
Definition measurement.h:42
Class of names of measurers.
auto name() const noexcept -> const MeasurerName &override
Get the name of this measurer.
~ProcessingTimeMeasurer() override=default
Destructor.
ProcessingTimeMeasurer(std::size_t samples, std::size_t min_warming_up_iterations, double min_warming_up_duration_sec)
Constructor.
auto measure(bench_impl::IBenchmarkCase *bench_case, const BenchmarkCondition &cond) const -> Measurement override
Measure durations.
Definition of IMeasurer class.
Definition of MeasurerName class.
Namespace of classes to measure time in benchmarks.
Namespace of stat_bench source codes.