A timer to measure time and time intervals. More...
#include <Timer.h>
Public Member Functions | |
Timer () | |
Creates a new timer. | |
virtual | ~Timer () |
Destroys this timer. | |
virtual double | start () |
Starts this timer and returns the current time in micro seconds. | |
virtual double | end () |
Returns the delay since the last call to start() in micro seconds. | |
virtual double | getTime () |
Returns the delay recorded at the last end() call. | |
virtual double | getAvgTime () |
Returns the average delay at every call to end() in micro seconds. | |
int | getNumCycles () const |
Returns the number of calls to start since last reset(). | |
double | getMinDuration () const |
Returns the lowest duration between a start() and an end() call in micro seconds. | |
double | getMaxDuration () const |
Returns the highest duration between a start() and an end() call in micro seconds. | |
virtual void | reset () |
Resets the statistics (total, average, min, and max durations). | |
Static Public Member Functions | |
static void | getDateTimeString (char *buffer, int bufSize) |
Get a string based on the current date and time of the day. | |
static void | getDateString (char *buffer, int bufSize) |
Get a string based on the current date. | |
static void | getTimeOfTheDayString (char *buffer, int bufSize) |
Get a string based on the current time of the day. | |
Protected Member Functions | |
double | getCurrentTime () |
Returns the current time in microseconds. | |
Protected Attributes | |
double | t |
Time of last call to start or reset. | |
double | totalDuration |
The accumulated elapsed time. | |
int | numCycles |
Number of calls to start since last reset() call. | |
double | lastDuration |
Last recorded duration recorded at end() call. | |
double | minDuration |
The lowest duration between a start() and an end() call in micro seconds. | |
double | maxDuration |
The highest duration between a start() and an end() call in micro seconds. | |
bool | running |
True if the timer has a start value. |
A timer to measure time and time intervals.
ork::Timer::Timer | ( | ) |
Creates a new timer.
virtual ork::Timer::~Timer | ( | ) | [virtual] |
Destroys this timer.
virtual double ork::Timer::end | ( | ) | [virtual] |
Returns the delay since the last call to start() in micro seconds.
Reimplemented in ork::GPUTimer.
virtual double ork::Timer::getAvgTime | ( | ) | [virtual] |
Returns the average delay at every call to end() in micro seconds.
This won't be accurate if the timer is not stopped.
Reimplemented in ork::GPUTimer.
double ork::Timer::getCurrentTime | ( | ) | [protected] |
Returns the current time in microseconds.
The origin of time may depend on the platform.
static void ork::Timer::getDateString | ( | char * | buffer, | |
int | bufSize | |||
) | [static] |
Get a string based on the current date.
Buffer must be of sufficient length. Format YYYY.MM.DD
static void ork::Timer::getDateTimeString | ( | char * | buffer, | |
int | bufSize | |||
) | [static] |
Get a string based on the current date and time of the day.
Buffer must be of sufficient length. Format YYYY.MM.DD.HH.MM.SS
double ork::Timer::getMaxDuration | ( | ) | const |
double ork::Timer::getMinDuration | ( | ) | const |
int ork::Timer::getNumCycles | ( | ) | const |
Returns the number of calls to start since last reset().
virtual double ork::Timer::getTime | ( | ) | [virtual] |
Returns the delay recorded at the last end() call.
Reimplemented in ork::GPUTimer.
static void ork::Timer::getTimeOfTheDayString | ( | char * | buffer, | |
int | bufSize | |||
) | [static] |
Get a string based on the current time of the day.
Buffer must be of sufficient length. Format HH.MM.SS
virtual void ork::Timer::reset | ( | ) | [virtual] |
Resets the statistics (total, average, min, and max durations).
virtual double ork::Timer::start | ( | ) | [virtual] |
Starts this timer and returns the current time in micro seconds.
Reimplemented in ork::GPUTimer.
double ork::Timer::lastDuration [protected] |
Last recorded duration recorded at end() call.
double ork::Timer::maxDuration [protected] |
double ork::Timer::minDuration [protected] |
int ork::Timer::numCycles [protected] |
Number of calls to start since last reset() call.
bool ork::Timer::running [protected] |
True if the timer has a start value.
double ork::Timer::t [protected] |
double ork::Timer::totalDuration [protected] |
The accumulated elapsed time.