Timer Utility

Why this Timer Utility Class CUtilTimer?

Timing a code snippet is an important part of performance analysis and tuning. There is not, however, a unique API or timer utility that works across Microsoft* Windows*, Linux*, and OS X*, which makes it difficult to maintain an application which runs on all three platforms. This timer class is designed to get around this problem by providing a common interface and hiding the platform specific implementations of extracting timing information from the programmer.


How to use this Timer Class in any application

CUtilTimer keeps track of both clock ticks and seconds passed with its start and stop functions.
CUtilTimer timer; // Create an instance of CUtilTimer class in your application
timer.start(); // Registers the start time
//Section of the code being timed
timer.stop(); //registers the end time
// Get the number seconds taken to execute that section of code
double dTotalSec = timer.get_time();
// Get the number of clock ticks taken to execute that section of code
long long lTotalTicks = timer.get_clock_ticks()
Last Updated: 
Thursday, July 11, 2013
For more complete information about compiler optimizations, see our Optimization Notice.