38 #ifndef OMPL_UTIL_PROFILER_
39 #define OMPL_UTIL_PROFILER_
41 #define ENABLE_PROFILING 1
43 #ifndef ENABLE_PROFILING
49 # define ENABLE_PROFILING 0
51 # define ENABLE_PROFILING 1
61 #include <boost/thread.hpp>
62 #include <boost/noncopyable.hpp>
64 #include "ompl/util/Time.h"
132 Profiler(
bool printOnDestroy =
false,
bool autoStart =
false) : running_(false), printOnDestroy_(printOnDestroy)
141 if (printOnDestroy_ && !data_.empty())
173 static void Event(
const std::string& name,
const unsigned int times = 1)
179 void event(
const std::string &name,
const unsigned int times = 1);
182 static void Average(
const std::string& name,
const double value)
188 void average(
const std::string &name,
const double value);
191 static void Begin(
const std::string &name)
197 static void End(
const std::string &name)
203 void begin(
const std::string &name);
206 void end(
const std::string &name);
211 static void Status(std::ostream &out = std::cout,
bool merge =
true)
219 void status(std::ostream &out = std::cout,
bool merge =
true);
249 TimeInfo(
void) : total(0, 0, 0, 0), shortest(boost::posix_time::pos_infin), longest(boost::posix_time::neg_infin), parts(0)
263 unsigned long int parts;
297 unsigned long int parts;
304 std::map<std::string, unsigned long int> events;
307 std::map<std::string, AvgInfo> avg;
310 std::map<std::string, TimeInfo> time;
313 void printThreadInfo(std::ostream &out,
const PerThread &data);
316 std::map<boost::thread::id, PerThread> data_;
319 bool printOnDestroy_;
378 static void Start(
void)
382 static void Stop(
void)
386 static void Clear(
void)
402 static void Event(
const std::string&,
const unsigned int = 1)
406 void event(
const std::string &,
const unsigned int = 1)
410 static void Average(
const std::string&,
const double)
414 void average(
const std::string &,
const double)
418 static void Begin(
const std::string &)
422 static void End(
const std::string &)
426 void begin(
const std::string &)
430 void end(
const std::string &)
434 static void Status(std::ostream & = std::cout,
bool =
true)
438 void status(std::ostream & = std::cout,
bool =
true)
boost::posix_time::time_duration duration
Representation of a time duration.
boost::posix_time::ptime point
Representation of a point in time.
point now(void)
Get the current time point.