#ifndef RIBPLOT_H_ #define RIBPLOT_H_ #include #include #include #include #include "benchmark.h" class RibPlot { public: /******************************************************************/ /* PUBLIC TYPES */ /******************************************************************/ /* * Different variants of the plot_lines plot. */ enum plot_function { BLANK = 0, DIVIDE, MULTIPLY, RATIO }; /******************************************************************/ /* PUBLIC METHODS */ /******************************************************************/ /* * The constructor. */ RibPlot(Benchmark * _bench, Benchmark * _thrash); /* * Default boxplot on every combination of parameters. */ void plot_default(const std::string & div_param, const std::string & mult_param, const std::string & x_param, bool column_lines); /* * Plot multiple lines (for different values of param_lines parameter) * and param_x parameter on the X axis. */ void plot_lines(const std::string & x_param, const std::string & lines_param, const plot_function fnc, const std::string & ratio_val, const bool legend, const std::string & colname); /* * Create tables for plotting everything with everything. */ void create_tables(const int filter); /* * Create one table with everything, not used anymore now. * * @deprecated */ void create_alltable(); /* * Can't even remember what this was for. * * @deprecated */ void write_param_combs(std::list & colnames); /******************************************************************/ /* PUBLIC ATTRIBUTES */ /******************************************************************/ /* * Default false. True - plot lines using linetypes instead of colors. */ bool nocolor; /* * Create gzip compressed tables and reference them as such in the R scripts. */ bool gzip_tables; /* * Use my_postscript() instead of png() in the R script, * don't call R (used for generating plot scripts for report. */ bool postscript; /* * List of column names to plot. */ std::list colNames; /* * Holds the ribplot's command line so it can be stored in the R scripts. */ std::string cmdLine; private: /******************************************************************/ /* PRIVATE TYPES */ /******************************************************************/ /* * Used to distinguish multiplication/division in mult_div(). */ enum mult_div_action { ACTION_MULT, ACTION_DIV }; /******************************************************************/ /* PRIVATE METHODS */ /******************************************************************/ /* * Invoke R on script of given name. */ void invoke_R(const std::string & scriptname); /* * Copies script from RIB_DIR/plotscripts/@scriptname to the r_script stream */ void copyScript (const std::string & scriptname); /* * Insert (to the R script) multiplication or division of results based * on benchmark's parameter definitions. */ void mult_div(const mult_div_action action, const std::string & colname, const std::string & user_param, const int bd, const int td); /* * Converts a benchmark parameter passed as string to its total depth (bench + thrash) * distinguishes T_ parameters and belonging to thrasher. * If param of the name is not found, returns -1. * * @param strict - true means perror and exit if param not found */ int param_depth(const std::string & param_name, bool strict); /******************************************************************/ /* PRIVATE ATTRIBUTES */ /******************************************************************/ /* Pointer to the benchmark instance. */ std::auto_ptr bench; /* Pointer to the trasher instance. */ std::auto_ptr thrash; /* Current output stream for writing R script. */ std::ofstream r_script; }; #endif /* RIIPLOT_H_ */