What is it ?

DbgProfiler provides an easy mechanism for profiling certain hotspots of an application by just adding a few PROFILE_BEGIN and PROFILE_END macros to the C++ source code. In contrast to some external "real" profilers the code can be compiled without any special compiler flags and with full compiler optimization enabled. Furthermore, the execution speed of the application will not be affected. This may be important for multimedia applications that don't work properly if they are slowed down by a profiler.
Unlike other similar tools, which just measure the execution time of a code block, the PROFILE_BEGIN - PROFILE_END pairs can be nested. A hierarchy of the callers and callees will be generated automatically and allows a detailed analysis similar to a "real" profiler. This analysis can be written to HTML files.


  • helps to find performance bottle necks
  • does not affect the execution speed of the application
  • applications can be compiled with full compiler optimization enabled and without any special compiler flags
  • detailed analysis and callers/callees statistics
  • HTML output
  • call graphs are visualized using the Graphviz dot tool if available
  • multi-threading support

How does it work ?

To profile certain hotspots of the application two macros (PROFILE_BEGIN and PROFILE_END) are provided. They must be inserted into the source code. While the application is executed the cpu clock cycles, which are spent between the PROFILE_BEGIN and the corresponding PROFILE_END macro, are counted. This is done by using Intels RDTSC instruction and a few inline assembler calls. Moreover the caller/callees hierarchy is built using an internal stack.



The source code is available at the projects sourceforge page.


Erik Einhorn

Last modified: 02 Dez. 2006 (Copyright 2006 by Erik Einhorn)