README.md

libProfiler

libProfiler is a tool to measure time taken by a code portion. It can help you improve code performance.
It can be easily integrated in your toolchain, continuous integration,...
It's implemented as only one multiplatform and threadsafe C++ header file! It works on Windows, Linux and MacOSX.
As you define the granularity, it may be more usefull than great tools like Verysleepy. And it
works well with debug info turned off and full optmisation turned on.
Sadly, it uses STL (nobody's perfect)

How to use it:

Include this header. For one of .cpp where it's included add:

#define LIB_PROFILER_IMPLEMENTATION

In your project preprocessor, define USE_PROFILER. If USE_PROFILER is not defined, every
libProfiler macro is defined empty. So depending on your project target, you can enable/disable
profiling.

Enable/disable profiling with USE_PROFILER.
In one of your .cpp file, define LIB_PROFILER_IMPLEMENTATION or you'll have troubles linking.
You can overide the default printf output redefining preprocessor LIB_PROFILER_PRINTF.
The sample will output:

The first list correspond to the callstack ( with left spaced function name). You might see a
a profiled block multiple time depending on where it was called.
The second list is a flat one. Profiled block only appear once.
Time unit is ms.

This text is also present in libProfiler.h

This has been possible thank to the work of Christophe Giraud and Maxime Houlier.