Profiler.h
85 ScopedBlock(const std::string &name, Profiler &prof = Profiler::Instance()) : name_(name), prof_(prof)
247 : total(time::seconds(0.)), shortest(time::duration::max()), longest(time::duration::min()), 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:171
static void Average(const std::string &name, const double value)
Maintain the average of a specific value.
Definition: Profiler.h:180
static void End(const std::string &name)
Stop counting time for a specific chunk of code.
Definition: Profiler.h:195
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:129
static void Console()
Print the status of the profiled code chunks and events to the console (using msg::Console) ...
Definition: Profiler.h:221
ScopedBlock(const std::string &name, Profiler &prof=Profiler::Instance())
Start counting time for the block named name of the profiler prof.
Definition: Profiler.h:85
std::chrono::system_clock::duration duration
Representation of a time duration.
Definition: Time.h:67
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:209
static void Begin(const std::string &name)
Begin counting time for a specific chunk of code.
Definition: Profiler.h:189
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:72
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:103
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:81
ScopedStart(Profiler &prof=Profiler::Instance())
Take as argument the profiler instance to operate on (prof)
Definition: Profiler.h:107