cpp-stat-bench 0.24.0
Benchmark library with statistics for C++.
Loading...
Searching...
No Matches
box_plot.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2025 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 <vector>
23
24#include <plotly_plotter/figure.h>
25#include <plotly_plotter/figure_builders/box.h>
26#include <plotly_plotter/write_html.h>
27
28#include "common_labels.h"
29#include "create_data_table.h"
32
33namespace stat_bench {
34namespace plots {
35
36auto BoxPlot::name_for_file() const -> const util::Utf8String& {
37 return name_for_file_;
38}
39
40void BoxPlot::write(const measurer::MeasurerName& measurer_name,
41 const BenchmarkGroupName& group_name,
42 const std::vector<measurer::Measurement>& measurements,
43 const std::string& file_path) {
44 (void)group_name;
45
46 const auto& title = measurer_name.str();
47
48 const auto data_table = create_data_table_with_all_time(measurements, {});
49 auto figure = plotly_plotter::figure_builders::box(data_table)
50 .y(time_label)
51 .group(case_name_label)
52 .log_y(true)
53 .box_mean("sd")
54 .create();
55 figure.title(title.str());
56 plotly_plotter::write_html(file_path, figure);
57}
58
59} // namespace plots
60} // namespace stat_bench
Definition of BoxPlot class.
Class of names of groups of benchmarks.
Class of names of measurers.
auto str() const noexcept -> const util::Utf8String &
Get the string of the name.
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.
Definition box_plot.cpp:40
auto name_for_file() const -> const util::Utf8String &override
Get a name for output files.
Definition box_plot.cpp:36
Definition of constants for labels in plots.
Declaration of create_data_table function.
Definition of MeasurerName class.
Namespace of plotting.
Definition box_plot.h:28
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 > &parameter_names) -> plotly_plotter::data_table
Create a data table with all samples of processing time.
Namespace of utility functions and classes.
Namespace of stat_bench source codes.
Definition of ParameterName class.