hpp-fcl  1.4.4
HPP fork of FCL -- The Flexible Collision Library
hpp::fcl::tools::Profiler Class Reference

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 <hpp/fcl/profile.h>

Inheritance diagram for hpp::fcl::tools::Profiler:
Collaboration diagram for hpp::fcl::tools::Profiler:

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 (bool printOnDestroy=false, bool autoStart=false)
 Constructor. It is allowed to separately instantiate this class (not only as a singleton) More...
 
 ~Profiler (void)
 Destructor. More...
 
void start (void)
 Start counting time. More...
 
void stop (void)
 Stop counting time. More...
 
void clear (void)
 Clear counted time and events. More...
 
void event (const std::string &name, const unsigned int times=1)
 Count a specific event for a number of times. More...
 
void average (const std::string &name, const double value)
 Maintain the average of a specific value. More...
 
void begin (const std::string &name)
 Begin counting time for a specific chunk of code. More...
 
void end (const std::string &name)
 Stop counting time for a specific chunk of code. More...
 
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. More...
 
bool running (void) const
 Check if the profiler is counting time or not. More...
 

Static Public Member Functions

static ProfilerInstance (void)
 Return an instance of the class. More...
 
static void Start (void)
 Start counting time. More...
 
static void Stop (void)
 Stop counting time. More...
 
static void Clear (void)
 Clear counted time and events. More...
 
static void Event (const std::string &name, const unsigned int times=1)
 Count a specific event for a number of times. More...
 
static void Average (const std::string &name, const double value)
 Maintain the average of a specific value. More...
 
static void Begin (const std::string &name)
 Begin counting time for a specific chunk of code. More...
 
static void End (const std::string &name)
 Stop counting time for a specific chunk of code. More...
 
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. More...
 
static bool Running (void)
 Check if the profiler is counting time or not. More...
 

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.

Constructor & Destructor Documentation

◆ Profiler()

hpp::fcl::tools::Profiler::Profiler ( bool  printOnDestroy = false,
bool  autoStart = false 
)
inline

Constructor. It is allowed to separately instantiate this class (not only as a singleton)

◆ ~Profiler()

hpp::fcl::tools::Profiler::~Profiler ( void  )
inline

Destructor.

Member Function Documentation

◆ Average()

static void hpp::fcl::tools::Profiler::Average ( const std::string &  name,
const double  value 
)
inlinestatic

Maintain the average of a specific value.

◆ average()

void hpp::fcl::tools::Profiler::average ( const std::string &  name,
const double  value 
)

Maintain the average of a specific value.

◆ Begin()

static void hpp::fcl::tools::Profiler::Begin ( const std::string &  name)
inlinestatic

Begin counting time for a specific chunk of code.

◆ begin()

void hpp::fcl::tools::Profiler::begin ( const std::string &  name)

Begin counting time for a specific chunk of code.

◆ Clear()

static void hpp::fcl::tools::Profiler::Clear ( void  )
inlinestatic

Clear counted time and events.

◆ clear()

void hpp::fcl::tools::Profiler::clear ( void  )

Clear counted time and events.

◆ End()

static void hpp::fcl::tools::Profiler::End ( const std::string &  name)
inlinestatic

Stop counting time for a specific chunk of code.

◆ end()

void hpp::fcl::tools::Profiler::end ( const std::string &  name)

Stop counting time for a specific chunk of code.

◆ Event()

static void hpp::fcl::tools::Profiler::Event ( const std::string &  name,
const unsigned int  times = 1 
)
inlinestatic

Count a specific event for a number of times.

◆ event()

void hpp::fcl::tools::Profiler::event ( const std::string &  name,
const unsigned int  times = 1 
)

Count a specific event for a number of times.

◆ Instance()

static Profiler& hpp::fcl::tools::Profiler::Instance ( void  )
static

Return an instance of the class.

◆ running()

bool hpp::fcl::tools::Profiler::running ( void  ) const
inline

Check if the profiler is counting time or not.

◆ Running()

static bool hpp::fcl::tools::Profiler::Running ( void  )
inlinestatic

Check if the profiler is counting time or not.

◆ Start()

static void hpp::fcl::tools::Profiler::Start ( void  )
inlinestatic

Start counting time.

◆ start()

void hpp::fcl::tools::Profiler::start ( void  )

Start counting time.

◆ Status()

static void hpp::fcl::tools::Profiler::Status ( std::ostream &  out = std::cout,
bool  merge = true 
)
inlinestatic

Print the status of the profiled code chunks and events. Optionally, computation done by different threads can be printed separately.

◆ status()

void hpp::fcl::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.

◆ Stop()

static void hpp::fcl::tools::Profiler::Stop ( void  )
inlinestatic

Stop counting time.

◆ stop()

void hpp::fcl::tools::Profiler::stop ( void  )

Stop counting time.


The documentation for this class was generated from the following file: