cpp-stat-bench 0.24.0
Benchmark library with statistics for C++.
Loading...
Searching...
No Matches
data_file_reporter_base.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2023 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#include <vector>
24
25#include <fmt/format.h>
26
29
30namespace stat_bench {
31namespace reporter {
32
34 : file_path_(std::move(file_path)) {}
35
37 const clock::SystemTimePoint& time_stamp) {
38 data_.started_at =
39 util::Utf8String(fmt::format(FMT_STRING("{}"), time_stamp));
40}
41
43 const clock::SystemTimePoint& time_stamp) {
44 data_.finished_at =
45 util::Utf8String(fmt::format(FMT_STRING("{}"), time_stamp));
46
47 write_data_file(file_path_, data_);
48}
49
51 const measurer::MeasurerName& /*name*/) {
52 // no operation
53}
54
56 const measurer::MeasurerName& /*name*/) {
57 // no operation
58}
59
61 const bench_impl::BenchmarkGroupConfig& /*config*/) {
62 // no operation
63}
64
66 // no operation
67}
68
70 // no operation
71}
72
74 const BenchmarkFullName& /*case_info*/) {
75 // no operation
76}
77
79 const measurer::Measurement& measurement) {
80 data_.measurements.push_back(data_file_spec::convert(measurement));
81}
82
84 const BenchmarkFullName& case_info, const BenchmarkCondition& cond,
85 const std::exception_ptr& error) {
86 // no operation
87 (void)case_info;
88 (void)cond;
89 (void)error;
90}
91
92} // namespace reporter
93} // namespace stat_bench
Class of conditions of benchmarks.
Class of information of cases in benchmarks.
Class of names of groups of benchmarks.
Class of configuration of a group of cases in benchmarks.
Class of time points of system clocks.
Class of data of measurements.
Definition measurement.h:42
Class of names of measurers.
void measurer_starts(const measurer::MeasurerName &name) final
Start benchmarks using a measurer.
DataFileReporterBase(std::string file_path)
Constructor.
void case_starts(const BenchmarkFullName &case_info) final
Start a case of a benchmark.
virtual void write_data_file(const std::string &file_path, const data_file_spec::RootData &data)=0
Write a data file.
void group_finished(const BenchmarkGroupName &name) final
Finished a group of benchmarks.
void measurement_failed(const BenchmarkFullName &case_info, const BenchmarkCondition &cond, const std::exception_ptr &error) final
Failed a measurement.
void measurer_finished(const measurer::MeasurerName &name) final
Finished benchmarks using a measurer.
void case_finished(const BenchmarkFullName &case_info) final
Finished a case of a benchmark.
void experiment_finished(const clock::SystemTimePoint &time_stamp) final
Finished an experiment.
void experiment_starts(const clock::SystemTimePoint &time_stamp) final
Start an experiment.
void group_starts(const BenchmarkGroupName &name, const bench_impl::BenchmarkGroupConfig &config) final
Start a group of benchmarks.
void measurement_succeeded(const measurer::Measurement &measurement) final
Successfully finished a measurement.
Class of UTF-8 encoded string.
Definition utf8_string.h:35
Declaration of functions to help output of data files.
Definition of DataFileReporterBase class.
auto convert(const param::ParameterDict &params) -> std::unordered_map< util::Utf8String, util::Utf8String >
Convert to data for data files.
Namespace of reporters of results of benchmarks.
Namespace of stat_bench source codes.
STL namespace.
Definition of Utf8String class.