38 #ifndef FCL_COMMON_DETAIL_PROFILER_H 39 #define FCL_COMMON_DETAIL_PROFILER_H 52 #include "fcl/export.h" 71 class FCL_EXPORT ScopedBlock;
77 class FCL_EXPORT ScopedStart;
84 Profiler(
bool printOnDestroy =
false,
bool autoStart =
false);
90 static void Start(
void);
93 static void Stop(
void);
96 static void Clear(
void);
108 static void Event(
const std::string&
name,
const unsigned int times = 1);
111 void event(
const std::string &
name,
const unsigned int times = 1);
114 static void Average(
const std::string&
name,
const double value);
117 void average(
const std::string &
name,
const double value);
120 static void Begin(
const std::string &
name);
123 static void End(
const std::string &
name);
126 void begin(
const std::string &
name);
129 void end(
const std::string &
name);
134 static void Status(std::ostream &out = std::cout,
bool merge =
true);
139 void status(std::ostream &out = std::cout,
bool merge =
true);
142 bool running(
void)
const;
145 static bool Running(
void);
193 std::map<std::string, unsigned long int>
events;
196 std::map<std::string, AvgInfo>
avg;
199 std::map<std::string, TimeInfo>
time;
202 void printThreadInfo(std::ostream &out,
const PerThread &data);
205 std::map<std::thread::id, PerThread>
data_;
214 class FCL_EXPORT
Profiler::ScopedBlock
233 class FCL_EXPORT
Profiler::ScopedStart
251 #endif // #ifndef FCL_COMMON_DETAIL_PROFILER_H
time::point start
The point in time when counting time started.
std::chrono::system_clock::duration duration
Representation of a time duration.
unsigned long int parts
Number of times a value was added to this structure.
time::duration shortest
The shortest counted time interval.
Information about time spent in a section of the code.
std::map< std::string, unsigned long int > events
The stored events.
unsigned long int parts
Number of times a chunk of time was added to this structure.
double total
The sum of the values to average.
Information maintained about averaged values.
static Profiler & Instance(void)
Return an instance of the class.
time::duration longest
The longest counted time interval.
std::map< std::string, AvgInfo > avg
The stored averages.
std::map< std::string, TimeInfo > time
The amount of time spent in various places.
double totalSqr
The sub of squares of the values to average.
Information to be maintained for each thread.
std::chrono::system_clock::time_point point
Representation of a point in time.
time::duration total
Total time counted.
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.
std::map< std::thread::id, PerThread > data_