cgv
|
A trivial stop watch class for time measurement. More...
#include <stopwatch.h>
Public Member Functions | |
stopwatch (bool silent=false) | |
stopwatch (double *result, bool silent=false) | |
void | add_time () |
double | get_elapsed_time () const |
return time elpased thus far | |
double | restart () |
restart timer and return time elapsed until restart | |
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.
Example 1:
{ stopwatch s; dosomethingtimeconsuming(); }
The duration is written into cout.
Example 2: double d = 0.0;
{ stopwatch s(&d); dosomethingtimeconsuming(); }
See also Profiler
Definition at line 34 of file stopwatch.h.
cgv::utils::stopwatch::stopwatch | ( | bool | silent = false | ) |
Definition at line 39 of file stopwatch.cxx.
cgv::utils::stopwatch::stopwatch | ( | double * | result, |
bool | silent = false |
||
) |
Definition at line 46 of file stopwatch.cxx.
cgv::utils::stopwatch::~stopwatch | ( | ) |
Definition at line 95 of file stopwatch.cxx.
void cgv::utils::stopwatch::add_time | ( | ) |
Definition at line 84 of file stopwatch.cxx.
double cgv::utils::stopwatch::get_elapsed_time | ( | ) | const |
return time elpased thus far
Definition at line 68 of file stopwatch.cxx.
Referenced by cgv::render::performance_monitor::finish_frame(), cgv::render::performance_monitor::finish_task(), cgv::render::performance_monitor::start_frame(), and cgv::render::performance_monitor::start_task().
double cgv::utils::stopwatch::restart | ( | ) |
restart timer and return time elapsed until restart
Definition at line 75 of file stopwatch.cxx.
Referenced by cgv::render::performance_monitor::start_frame().