38 #ifndef FCL_COMMON_DETAIL_PROFILER_H 39 #define FCL_COMMON_DETAIL_PROFILER_H 51 #include "fcl/common/time.h" 83 Profiler(
bool printOnDestroy =
false,
bool autoStart =
false);
89 static void Start(
void);
92 static void Stop(
void);
95 static void Clear(
void);
107 static void Event(
const std::string& name,
const unsigned int times = 1);
110 void event(
const std::string &name,
const unsigned int times = 1);
113 static void Average(
const std::string& name,
const double value);
116 void average(
const std::string &name,
const double value);
119 static void Begin(
const std::string &name);
122 static void End(
const std::string &name);
125 void begin(
const std::string &name);
128 void end(
const std::string &name);
133 static void Status(std::ostream &out = std::cout,
bool merge =
true);
138 void status(std::ostream &out = std::cout,
bool merge =
true);
163 unsigned long int parts;
185 unsigned long int parts;
192 std::map<std::string, unsigned long int> events;
195 std::map<std::string, AvgInfo> avg;
198 std::map<std::string, TimeInfo> time;
201 void printThreadInfo(std::ostream &out,
const PerThread &data);
204 std::map<std::thread::id, PerThread> data_;
207 bool printOnDestroy_;
250 #endif // #ifndef FCL_COMMON_DETAIL_PROFILER_H std::chrono::system_clock::duration duration
Representation of a time duration.
Definition: time.h:54
This instance will call Profiler::start() when constructed and Profiler::stop() when it goes out of s...
Definition: profiler.h:232
Main namespace.
Definition: broadphase_bruteforce-inl.h:45
void clear(void)
Clear counted time and events.
Definition: profiler.cpp:108
static bool Running(void)
Check if the profiler is counting time or not.
Definition: profiler.cpp:235
static void Begin(const std::string &name)
Begin counting time for a specific chunk of code.
Definition: profiler.cpp:150
This instance will call Profiler::begin() when constructed and Profiler::end() when it goes out of sc...
Definition: profiler.h:213
static void End(const std::string &name)
Stop counting time for a specific chunk of code.
Definition: profiler.cpp:156
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.cpp:178
static void Event(const std::string &name, const unsigned int times=1)
Count a specific event for a number of times.
Definition: profiler.cpp:119
static Profiler & Instance(void)
Return an instance of the class.
Definition: profiler.cpp:44
void average(const std::string &name, const double value)
Maintain the average of a specific value.
Definition: profiler.cpp:139
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.cpp:184
void event(const std::string &name, const unsigned int times=1)
Count a specific event for a number of times.
Definition: profiler.cpp:125
static void Start(void)
Start counting time.
Definition: profiler.cpp:66
void stop(void)
Stop counting time.
Definition: profiler.cpp:96
~Profiler(void)
Destructor.
Definition: profiler.cpp:59
static void Clear(void)
Clear counted time and events.
Definition: profiler.cpp:78
std::chrono::system_clock::time_point point
Representation of a point in time.
Definition: time.h:51
void end(const std::string &name)
Stop counting time for a specific chunk of code.
Definition: profiler.cpp:170
static void Average(const std::string &name, const double value)
Maintain the average of a specific value.
Definition: profiler.cpp:133
bool running(void) const
Check if the profiler is counting time or not.
Definition: profiler.cpp:229
void start(void)
Start counting time.
Definition: profiler.cpp:84
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:61
void begin(const std::string &name)
Begin counting time for a specific chunk of code.
Definition: profiler.cpp:162
static void Stop(void)
Stop counting time.
Definition: profiler.cpp:72