a Class to measure passing time.
The class computes passing time by counting the number of ticks per second. That is, the following code computes the execution time in seconds:
tm.start();
tm.stop();
std::cout << tm.getTimeSec();
It is also possible to compute the average time over multiple runs:
for (int i = 0; i < 100; i++)
{
tm.start();
tm.stop();
}
double average_time = tm.getTimeSec() / tm.getCounter();
std::cout << "Average time in second per iteration is: " << average_time << std::endl;
- See also
- getTickCount, getTickFrequency