Profiler.h
86 ScopedBlock(const std::string &name, Profiler &prof = Profiler::Instance()) : name_(name), prof_(prof)
132 Profiler(bool printOnDestroy = false, bool autoStart = false) : running_(false), printOnDestroy_(printOnDestroy)
249 TimeInfo() : total(0, 0, 0, 0), shortest(boost::posix_time::pos_infin), longest(boost::posix_time::neg_infin), parts(0)
static void Event(const std::string &name, const unsigned int times=1)
Count a specific event for a number of times.
Definition: Profiler.h:173
static void Average(const std::string &name, const double value)
Maintain the average of a specific value.
Definition: Profiler.h:182
static void End(const std::string &name)
Stop counting time for a specific chunk of code.
Definition: Profiler.h:197
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 th...
void event(const std::string &name, const unsigned int times=1)
Count a specific event for a number of times.
Profiler(bool printOnDestroy=false, bool autoStart=false)
Constructor. It is allowed to separately instantiate this class (not only as a singleton) ...
Definition: Profiler.h:132
static void Console()
Print the status of the profiled code chunks and events to the console (using msg::Console) ...
Definition: Profiler.h:223
ScopedBlock(const std::string &name, Profiler &prof=Profiler::Instance())
Start counting time for the block named name of the profiler prof.
Definition: Profiler.h:86
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 th...
Definition: Profiler.h:211
static void Begin(const std::string &name)
Begin counting time for a specific chunk of code.
Definition: Profiler.h:191
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: Profiler.h:77
void console()
Print the status of the profiled code chunks and events to the console (using msg::Console) ...
This instance will call Profiler::start() when constructed and Profiler::stop() when it goes out of s...
Definition: Profiler.h:104
void average(const std::string &name, const double value)
Maintain the average of a specific value.
This instance will call Profiler::begin() when constructed and Profiler::end() when it goes out of sc...
Definition: Profiler.h:82
ScopedStart(Profiler &prof=Profiler::Instance())
Take as argument the profiler instance to operate on (prof)
Definition: Profiler.h:109