开源软件名称:CedricGuillemet/libProfiler开源软件地址:https://github.com/CedricGuillemet/libProfiler开源编程语言:C 97.4%开源软件介绍:libProfilerlibProfiler 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:
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. Let's see an example code :
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. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论