11 namespace bp = boost::process;
17 auto path = bp::search_path(
"gnuplot");
19 throw Exception(1,
"GNUPlot not found, please install!");
21 gnuplot_ = bp::child(bp::search_path(
"gnuplot"),
26 throw Exception(1,
"GNUPlot helper not supported, Boost 1.64 and above is required!");
85 in->writeline(
"set datafile separator \",\"");
88 auto n = options.
points.size();
90 auto it1 = options.
points.begin();
93 in->write(
log::format(
"'%1%' using 1:2 with lines lw 2 title \"%2%\"",
102 auto it2 = options.
points.begin();
105 for (
const auto &point : it2->second)
106 in->writeline(
log::format(
"%1%,%2%", point.first, point.second));
117 in->writeline(
"set datafile separator \",\"");
119 in->writeline(
"set style data boxplot");
120 in->writeline(
"set style fill solid 0.5 border -1");
121 in->writeline(
"unset key");
124 in->writeline(
"set style boxplot sorted");
127 in->writeline(
"set style boxplot outliers pointtype 7");
129 in->writeline(
"set style boxplot nooutliers");
131 auto n = options.
values.size();
133 in->write(
"set xtics (");
134 auto it1 = options.
values.begin();
137 in->write(
log::format(
"\"%1%\" %2%", it1->first, i + 1));
141 in->writeline(
") scale 0.0");
155 auto it2 = options.
values.begin();
158 for (
const auto &point : it2->second)
168 instances_.emplace(name, std::make_shared<Instance>());
189 for (
const auto &query : results.
data)
191 const auto &name = query.first;
192 const auto &points = query.second;
195 for (
const auto &run : points)
203 bpo.
values.emplace(name, values);
Exception that contains a message and an error code.
void writeline(const std::string &line)
void write(const std::string &line)
Instance()
Constructor. Setups up pipe to GNUPlot.
std::map< std::string, std::shared_ptr< Instance > > instances_
Map of open GNUPlot instances.
std::shared_ptr< Instance > getInstance(const std::string &name)
Get the named GNUPlot instance.
void boxplot(const BoxPlotOptions &options)
Plot box data.
void timeseries(const TimeSeriesOptions &options)
Plot timeseries data.
void configurePlot(const PlottingOptions &options)
Configure a plot using common options.
const std::string metric_
~GNUPlotPlanDataSetOutputter() override
Destructor.
void dump(const PlanDataSet &results) override
Visualize results.
GNUPlotPlanDataSetOutputter(const std::string &metric)
Constructor.
Detailed statistics about a benchmark of multiple queries.
std::map< std::string, std::vector< PlanDataPtr > > data
Map of query name to collected data.
std::string name
Name of this dataset.
T emplace_back(T... args)
File and ROS Input / Output operations.
std::string format(const std::string &fmt, Args &&... args)
Recursion base case, return string form of formatted arguments.
std::map< std::string, Values > values
Map of names to data.
double max
Upper axis limit. If NaN, will auto-adjust.
double min
Lower axis limit. If NaN, will auto-adjust.
std::string label
Axis label.
std::string title
Title of the plot.
std::string mode
Terminal mode for GNUPlot.
Time series plotting options.
std::map< std::string, Series > points
Map of names to time series data.