27#include <fmt/format.h>
28#include <plotly_plotter/figure.h>
29#include <plotly_plotter/figure_builders/box.h>
30#include <plotly_plotter/write_html.h>
43 : parameter_name_(
std::move(parameter_name)),
45 name_for_file_(create_name_for_file(parameter_name_, options_)) {}
48 return name_for_file_;
53 const std::vector<measurer::Measurement>& measurements,
54 const std::string& file_path) {
57 const auto& title = measurer_name.
str();
59 std::vector<param::ParameterName> parameter_names;
60 parameter_names.push_back(parameter_name_);
61 if (!options_.subplot_column_parameter_name().empty()) {
62 parameter_names.emplace_back(
63 options_.subplot_column_parameter_name().data());
65 if (!options_.subplot_row_parameter_name().empty()) {
66 parameter_names.emplace_back(
67 options_.subplot_row_parameter_name().data());
70 const auto data_table =
72 auto figure_builder = plotly_plotter::figure_builders::box(data_table)
73 .x(parameter_name_.str().str())
78 if (!options_.subplot_column_parameter_name().empty()) {
79 figure_builder.subplot_column(
80 options_.subplot_column_parameter_name().data());
82 if (!options_.subplot_row_parameter_name().empty()) {
83 figure_builder.subplot_row(
84 options_.subplot_row_parameter_name().data());
86 auto figure = figure_builder.create();
87 figure.title(title.str());
88 plotly_plotter::write_html(file_path, figure);
91auto ParameterToTimeBoxPlot::create_name_for_file(
94 fmt::memory_buffer buffer;
95 fmt::format_to(std::back_inserter(buffer),
"by_{}_box",
97 if (!options.subplot_column_parameter_name().empty()) {
98 fmt::format_to(std::back_inserter(buffer),
"_by_{}",
100 options.subplot_column_parameter_name().data())));
102 if (!options.subplot_row_parameter_name().empty()) {
103 fmt::format_to(std::back_inserter(buffer),
"_by_{}",
107 return util::Utf8String(std::string(buffer.data(), buffer.size()));
Class of names of groups of benchmarks.
Class of options for plots.
Class of names of measurers.
auto str() const noexcept -> const util::Utf8String &
Get the string of the name.
Class of names of parameters.
ParameterToTimeBoxPlot(param::ParameterName parameter_name, PlotOptions options)
Constructor.
auto name_for_file() const -> const util::Utf8String &override
Get a name for output files.
void write(const measurer::MeasurerName &measurer_name, const BenchmarkGroupName &group_name, const std::vector< measurer::Measurement > &measurements, const std::string &file_path) override
Write a plot.
Class of UTF-8 encoded string.
Definition of constants for labels in plots.
Declaration of create_data_table function.
Declaration of escape_for_file_name function.
Definition of MeasurerName class.
constexpr const char * time_label
Label for processing time in plots.
constexpr const char * case_name_label
Label for case names in plots.
auto create_data_table_with_all_time(const std::vector< measurer::Measurement > &measurements, const std::vector< param::ParameterName > ¶meter_names) -> plotly_plotter::data_table
Create a data table with all samples of processing time.
Namespace of utility functions and classes.
auto escape_for_file_name(const Utf8String &input) -> Utf8String
Escape a string for a file name.
Namespace of stat_bench source codes.
Definition of ParameterToTimeBoxPlot class.
Declaration of check_glob_pattern function.