27#include <fmt/format.h>
42 : prefix_(
std::move(prefix)), group_name_(
""), measurement_type_(
"") {
43 builtin_plots_.push_back(std::make_shared<plots::SamplesLinePlot>());
44 builtin_plots_.push_back(std::make_shared<plots::CdfLinePlot>());
45 builtin_plots_.push_back(std::make_shared<plots::ViolinPlot>());
46 builtin_plots_.push_back(std::make_shared<plots::BoxPlot>());
62 group_plots_ = config.
plots();
71 measurement_type_ = type;
73 std::string measurement_type_without_space = measurement_type_.
str().str();
75 while ((pos = measurement_type_without_space.find(
' ', pos)) !=
77 measurement_type_without_space.erase(pos, 1);
86 const auto process_plot = [
this](
87 const std::shared_ptr<plots::IPlot>& plot) {
88 const std::string file_path = fmt::format(
"{}/{}/{}_{}.html", prefix_,
90 measurement_type_for_file_paths_,
92 std::filesystem::create_directories(
93 std::filesystem::path(file_path).parent_path());
94 plot->write(measurement_type_, group_name_, measurements_, file_path);
96 for (
const auto& plot : builtin_plots_) {
99 for (
const auto& plot : group_plots_) {
103 measurements_.clear();
116 measurements_.push_back(measurement);
Definition of BenchmarkGroupConfig class.
Definition of BenchmarkGroupName class.
Definition of BoxPlot class.
Definition of CdfLinePlot class.
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.
auto plots() const noexcept -> const std::vector< std::shared_ptr< plots::IPlot > > &
Get the plots in the group.
Class of time points of system clocks.
Class of names of measurement types.
auto str() const noexcept -> const util::Utf8String &
Get the string of the name.
Class of data of measurements.
void group_starts(const BenchmarkGroupName &name, const bench_impl::BenchmarkGroupConfig &config) override
Start a group of benchmarks.
void case_finished(const BenchmarkFullName &case_info) override
Finished a case of a benchmark.
PlotReporter(std::string prefix)
Constructor.
void experiment_starts(const clock::SystemTimePoint &time_stamp) override
Start an experiment.
void case_starts(const BenchmarkFullName &case_info) override
Start a case of a benchmark.
void measurement_succeeded(const measurer::Measurement &measurement) override
Successfully finished a measurement.
void measurement_type_starts(const measurer::MeasurementType &type) final
Start a measurement with a type.
void group_finished(const BenchmarkGroupName &name) override
Finished a group of benchmarks.
void measurement_failed(const BenchmarkFullName &case_info, const BenchmarkCondition &cond, const std::exception_ptr &error) override
Failed a measurement.
void experiment_finished(const clock::SystemTimePoint &time_stamp) override
Finished an experiment.
void measurement_type_finished(const measurer::MeasurementType &type) final
Finished a measurement with a type.
Class of UTF-8 encoded string.
Declaration of escape_for_file_name function.
Namespace of reporters of results of benchmarks.
auto escape_for_file_name(const Utf8String &input) -> Utf8String
Escape a string for a file name.
Namespace of stat_bench source codes.
Definition of PlotReporter class.
Definition of SamplesLinePlot class.
Definition of Utf8String class.
Definition of ViolinPlot class.