This is a simple thread-safe tool for counting time spent in various chunks of code. This is different from external profiling tools in that it allows the user to count time spent in various bits of code (sub-function granularity) or count how many times certain pieces of code are executed. More...
#include <ompl/tools/debug/Profiler.h>
Classes | |
class | ScopedBlock |
This instance will call Profiler::begin() when constructed and Profiler::end() when it goes out of scope. More... | |
class | ScopedStart |
This instance will call Profiler::start() when constructed and Profiler::stop() when it goes out of scope. If the profiler was already started, this block's constructor and destructor take no action. More... |
Public Member Functions | |
Profiler (const Profiler &)=delete | |
Profiler & | operator= (const Profiler &)=delete |
Profiler (bool printOnDestroy=false, bool autoStart=false) | |
Constructor. It is allowed to separately instantiate this class (not only as a singleton) | |
~Profiler () | |
Destructor. | |
void | start () |
Start counting time. | |
void | stop () |
Stop counting time. | |
void | clear () |
Clear counted time and events. | |
void | event (const std::string &name, const unsigned int times=1) |
Count a specific event for a number of times. | |
void | average (const std::string &name, const double value) |
Maintain the average of a specific value. | |
void | begin (const std::string &name) |
Begin counting time for a specific chunk of code. | |
void | end (const std::string &name) |
Stop counting time for a specific chunk of code. | |
void | status (std::ostream &out=std::cout, bool merge=true) |
Print the status of the profiled code chunks and events. Optionally, computation done by different threads can be printed separately. | |
void | console () |
Print the status of the profiled code chunks and events to the console (using msg::Console) | |
bool | running () const |
Check if the profiler is counting time or not. |
Static Public Member Functions | |
static Profiler & | Instance () |
Return an instance of the class. | |
static void | Start () |
Start counting time. | |
static void | Stop () |
Stop counting time. | |
static void | Clear () |
Clear counted time and events. | |
static void | Event (const std::string &name, const unsigned int times=1) |
Count a specific event for a number of times. | |
static void | Average (const std::string &name, const double value) |
Maintain the average of a specific value. | |
static void | Begin (const std::string &name) |
Begin counting time for a specific chunk of code. | |
static void | End (const std::string &name) |
Stop counting time for a specific chunk of code. | |
static void | Status (std::ostream &out=std::cout, bool merge=true) |
Print the status of the profiled code chunks and events. Optionally, computation done by different threads can be printed separately. | |
static void | Console () |
Print the status of the profiled code chunks and events to the console (using msg::Console) | |
static bool | Running () |
Check if the profiler is counting time or not. |
Detailed Description
This is a simple thread-safe tool for counting time spent in various chunks of code. This is different from external profiling tools in that it allows the user to count time spent in various bits of code (sub-function granularity) or count how many times certain pieces of code are executed.
Definition at line 72 of file Profiler.h.
Constructor & Destructor Documentation
◆ Profiler()
|
inline |
Constructor. It is allowed to separately instantiate this class (not only as a singleton)
Definition at line 129 of file Profiler.h.
◆ ~Profiler()
|
inline |
Destructor.
Definition at line 137 of file Profiler.h.
Member Function Documentation
◆ Average()
|
inlinestatic |
Maintain the average of a specific value.
Definition at line 180 of file Profiler.h.
◆ average()
void ompl::tools::Profiler::average | ( | const std::string & | name, |
const double | value ) |
Maintain the average of a specific value.
Definition at line 92 of file Profiler.cpp.
◆ Begin()
|
inlinestatic |
Begin counting time for a specific chunk of code.
Definition at line 189 of file Profiler.h.
◆ begin()
void ompl::tools::Profiler::begin | ( | const std::string & | name | ) |
Begin counting time for a specific chunk of code.
Definition at line 102 of file Profiler.cpp.
◆ Clear()
|
inlinestatic |
Clear counted time and events.
Definition at line 156 of file Profiler.h.
◆ clear()
void ompl::tools::Profiler::clear | ( | ) |
Clear counted time and events.
Definition at line 75 of file Profiler.cpp.
◆ Console()
|
inlinestatic |
Print the status of the profiled code chunks and events to the console (using msg::Console)
Definition at line 221 of file Profiler.h.
◆ console()
void ompl::tools::Profiler::console | ( | ) |
Print the status of the profiled code chunks and events to the console (using msg::Console)
Definition at line 163 of file Profiler.cpp.
◆ End()
|
inlinestatic |
Stop counting time for a specific chunk of code.
Definition at line 195 of file Profiler.h.
◆ end()
void ompl::tools::Profiler::end | ( | const std::string & | name | ) |
Stop counting time for a specific chunk of code.
Definition at line 109 of file Profiler.cpp.
◆ Event()
|
inlinestatic |
Count a specific event for a number of times.
Definition at line 171 of file Profiler.h.
◆ event()
void ompl::tools::Profiler::event | ( | const std::string & | name, |
const unsigned int | times = 1 ) |
Count a specific event for a number of times.
Definition at line 85 of file Profiler.cpp.
◆ Instance()
|
static |
Return an instance of the class.
Definition at line 40 of file Profiler.cpp.
◆ Running()
|
inlinestatic |
Check if the profiler is counting time or not.
Definition at line 237 of file Profiler.h.
◆ running()
|
inline |
Check if the profiler is counting time or not.
Definition at line 231 of file Profiler.h.
◆ Start()
|
inlinestatic |
Start counting time.
Definition at line 144 of file Profiler.h.
◆ start()
void ompl::tools::Profiler::start | ( | ) |
Start counting time.
Definition at line 53 of file Profiler.cpp.
◆ Status()
|
inlinestatic |
Print the status of the profiled code chunks and events. Optionally, computation done by different threads can be printed separately.
Definition at line 209 of file Profiler.h.
◆ status()
void ompl::tools::Profiler::status | ( | std::ostream & | out = std::cout, |
bool | merge = true ) |
Print the status of the profiled code chunks and events. Optionally, computation done by different threads can be printed separately.
Definition at line 116 of file Profiler.cpp.
◆ Stop()
|
inlinestatic |
Stop counting time.
Definition at line 150 of file Profiler.h.
◆ stop()
void ompl::tools::Profiler::stop | ( | ) |
Stop counting time.
Definition at line 64 of file Profiler.cpp.
The documentation for this class was generated from the following files:
- ompl/tools/debug/Profiler.h
- ompl/tools/debug/src/Profiler.cpp