This class provides the utilities to benchmark Fast Marching Solvers (configuration, running and logging). It works for FMM (any heap and SFMM), FIM and UFMM. It has not been tested with FM2 solvers. More...
#include <benchmark.hpp>
Public Member Functions | |
Benchmark (unsigned int saveGrid=0, bool saveLog=true) | |
void | fromCFG (bool cfg) |
Set true if the benchmark is configured from a cfg file. | |
void | addSolver (Solver< grid_t > *solver) |
Adds a new solver to be benchmarked. | |
void | setSaveGrid (unsigned int s) |
Sets the saveGrid_ flag. | |
void | setEnvironment (grid_t *grid) |
Sets the environment (grid map) the benchmark will be run on. | |
void | setNRuns (unsigned int n) |
Set number of runs for each solver. | |
void | setPath (const boost::filesystem::path &path) |
Set the path where results will be saved. | |
void | setSaveLog (bool s) |
Sets the flag to save the log to a file (true) or output in terminal (false). | |
void | setInitialAndGoalPoints (const std::vector< unsigned int > &init_points, unsigned int goal_idx) |
Sets the initial and goal points (indices) for the solvers. | |
void | setInitialPoints (const std::vector< unsigned int > &init_points) |
Sets the initial points (indices for the solvers). | |
void | run () |
Automatically runs all the solvers. | |
void | logRun (const Solver< grid_t > *s) |
Logs the last run of solver s. | |
void | saveGrid (Solver< grid_t > *s) const |
Saves the grid values result of the last run of solver s. | |
void | saveLog () const |
Saves the log to a file: benchmark_name.log. | |
void | setName (const std::string &n) |
Sets the name of the benchmark. | |
void | clear () |
Clears and free memory allocated by the benchmark. | |
Private Member Functions | |
void | logConfig () |
Logs the benchmark configuration. | |
void | configSolvers () |
Configures each solver so they are ready to be run. | |
void | formatID () |
Formats as a string the run ID. | |
Private Attributes | |
std::vector< Solver< grid_t > * > | solvers_ |
Stores the solvers to be run in the benchmark. | |
grid_t * | grid_ |
Grid the benchmark will be run on. | |
std::vector< unsigned int > | init_points_ |
Indices of the initial points. | |
unsigned int | goal_idx_ |
Index of the goal point. | |
std::chrono::time_point < std::chrono::system_clock > | start_ |
Time measurement variables. | |
std::chrono::time_point < std::chrono::system_clock > | end_ |
std::stringstream | log_ |
Log stream. | |
unsigned int | saveGrid_ |
If 1, the resulting grids (times) of the first run of each solver are saved to files. If 2, the grids for all runs of each solver are saved. | |
bool | saveLog_ |
If true, the log is saved to file. Output on terminal otherwise. | |
unsigned int | runID_ |
ID of the current run. | |
std::string | fmtID_ |
Formatted run ID: | |
unsigned int | nruns_ |
Number of runs for each solver. | |
boost::filesystem::path | path_ |
Path were the results will be saved. | |
std::string | name_ |
Benchmark name. | |
bool | fromCFG_ |
If true, benchmark configured from CFG file, used to selectively free memory. | |
By default, it will save a log file in a generated folder called results.
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
Definition at line 33 of file benchmark.hpp.