27#include <fmt/format.h>
42 : prefix_(
std::move(prefix)), measurer_name_(
"") {
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>());
60 measurer_name_ = name;
62 std::string measurer_name_without_space = measurer_name_.
str().str();
64 while ((pos = measurer_name_without_space.find(
' ', pos)) !=
66 measurer_name_without_space.erase(pos, 1);
79 measurements_.clear();
80 group_plots_ = config.
plots();
84 const auto process_plot = [
this, &name](
85 const std::shared_ptr<plots::IPlot>& plot) {
86 const std::string file_path = fmt::format(
"{}/{}/{}_{}.html", prefix_,
88 measurer_name_for_file_paths_,
90 std::filesystem::create_directories(
91 std::filesystem::path(file_path).parent_path());
92 plot->write(measurer_name_, name, measurements_, file_path);
94 for (
const auto& plot : builtin_plots_) {
97 for (
const auto& plot : group_plots_) {
112 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.
auto str() const noexcept -> const util::Utf8String &
Get the string of the name.
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 data of measurements.
Class of names of measurers.
auto str() const noexcept -> const util::Utf8String &
Get the string of the name.
void measurer_starts(const measurer::MeasurerName &name) override
Start benchmarks using a measurer.
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.
void measurer_finished(const measurer::MeasurerName &name) override
Finished benchmarks using a measurer.
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 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.
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.