cgv
cgv::utils::stopwatch Class Reference

#include <stopwatch.h>

Public Member Functions

double get_elapsed_time () const
 return time elpased thus far
 
double restart ()
 restart timer and return time elapsed until restart
 

Detailed Description

A trivial stop watch class for time measurement. On Win32 the perfomance counter with a resolution of 0,313 microseconds is used, if available. If the performance counter is not available and on other systems the std::clock() function with a resolution of 0,055 milliseconds is used.

TODO: Better implementation for Linux (with higher resolution)

Example 1:

{ stopwatch s; dosomethingtimeconsuming(); }

The duration is written into cout.

Example 2: double d = 0.0;

{ stopwatch s(&d); dosomethingtimeconsuming(); }

See also Profiler


The documentation for this class was generated from the following files: