22 #include <Eigen/Eigen> 23 #include <boost/algorithm/string/predicate.hpp> 24 #include <boost/filesystem.hpp> 25 #include <boost/foreach.hpp> 35 #ifdef HAVE_PYTHONLIBS 44 int main(
int argc,
char **argv) {
52 PRINT_ERROR(
RED "ERROR: ./timing_histagram <file_times.txt> <num_bins>\n" RESET);
53 PRINT_ERROR(
RED "ERROR: rosrun ov_eval timing_flamegraph <file_times.txt> <num_bins>\n" RESET);
54 std::exit(EXIT_FAILURE);
56 int nbins = atoi(argv[2]);
59 std::vector<std::string> names;
60 std::vector<double> times;
61 std::vector<Eigen::VectorXd> timing_values;
63 PRINT_INFO(
"[TIME]: loaded %d timestamps from file (%d categories)!!\n", (
int)times.size(), (int)names.size());
66 std::vector<ov_eval::Statistics> stats;
67 for (
size_t i = 0; i < names.size(); i++)
71 for (
size_t i = 0; i < times.size(); i++) {
72 for (
size_t c = 0; c < names.size(); c++) {
73 stats.at(c).timestamps.push_back(times.at(i));
74 stats.at(c).values.push_back(1000.0 * timing_values.at(i)(c));
78 #ifdef HAVE_PYTHONLIBS 83 std::vector<std::string> colors_valid = {
"navy",
"blue",
"lightgreen",
"green",
"orange",
"goldenrod",
"red",
"pink",
"black"};
86 for (
size_t i = 0; i < names.size(); i++) {
Statistics object for a given set scalar time series values.
bool hist(const std::vector< Numeric > &y, long bins=10, std::string color="b", double alpha=1.0, bool cumulative=false)
void figure_size(size_t w, size_t h)
int main(int argc, char **argv)
void show(const bool block=true)
static void setPrintLevel(const std::string &level)
#define PRINT_ERROR(x...)
void xlabel(const std::string &str, const std::map< std::string, std::string > &keywords={})
void ylabel(const std::string &str, const std::map< std::string, std::string > &keywords={})
static void load_timing_flamegraph(std::string path, std::vector< std::string > &names, std::vector< double > ×, std::vector< Eigen::VectorXd > &timing_values)
Load comma separated timing file from pid_ros.py file.