Profiler uses WIN32 API function QueryPerformanceCounter() to measured C++ code fragment execution time with 0.8 microsecond precision.
Usage example:
#include "profiler.hpp" void someFunction () { while (1) { // some other code . . . { Profiler test1 ("test1_timing.txt", 100); testFunction1 (); } // some other code . . . } // endwhile } // end someFunction
The code above measures time between test1 object creation and destruction (by going out of scope). As a result testFunction1() execution time is measured. Every 100 iteration results are appended to text file test_timing.txt. Time is measured in computer timer ticks (approximately 0.8 microseconds). The API function QueryPerformanceFrequency () could be used to retrieve it's exact frequency.
Back to win32 source code downloads