opensurgsim
|
Timer class, measures execution times. More...
#include <Timer.h>
Public Member Functions | |
Timer () | |
Instantiate a TimerClock and start a timing run. | |
void | start () |
Begin a timing run by clearing out any stored frames and beginning a frame. | |
void | beginFrame () |
Begin a frame (storing the current time). | |
void | endFrame () |
End this frame by storing the duration since the current frame was begun. More... | |
void | markFrame () |
End the current frame and begin a new frame. | |
double | getCumulativeTime () const |
Return the sum of the durations over all the stored frames. More... | |
double | getCurrentTime () |
Return the amount of time spent in the current frame. More... | |
double | getAverageFramePeriod () const |
Return the average duration across all stored frames. More... | |
double | getAverageFrameRate () const |
Return the inverse of the average duration across all stored frames. More... | |
double | getLastFramePeriod () const |
Return the duration of the most-recent frame (time between last endFrame and the previous start , beginFrame , or endFrame ). More... | |
double | getLastFrameRate () const |
Return the inverse of the duration of the most-recent frame. More... | |
void | setMaxNumberOfFrames (size_t numberOfFrames) |
Set the maximum number of frames to store. | |
size_t | getMaxNumberOfFrames () |
size_t | getCurrentNumberOfFrames () const |
size_t | getNumberOfClockFails () const |
double | getMaxFramePeriod () const |
double | getMinFramePeriod () const |
bool | isBufferFull () const |
Timer class, measures execution times.
Multiple times can be stored as "frames" to provide an average rate or period.
void SurgSim::Framework::Timer::endFrame | ( | ) |
End this frame by storing the duration since the current frame was begun.
endFrame
does not start a new frame, call beginFrame
to do so. double SurgSim::Framework::Timer::getAverageFramePeriod | ( | ) | const |
Return the average duration across all stored frames.
Asserts if there are no frames.
double SurgSim::Framework::Timer::getAverageFrameRate | ( | ) | const |
Return the inverse of the average duration across all stored frames.
Asserts if there are no frames.
double SurgSim::Framework::Timer::getCumulativeTime | ( | ) | const |
Return the sum of the durations over all the stored frames.
size_t SurgSim::Framework::Timer::getCurrentNumberOfFrames | ( | ) | const |
double SurgSim::Framework::Timer::getCurrentTime | ( | ) |
Return the amount of time spent in the current frame.
double SurgSim::Framework::Timer::getLastFramePeriod | ( | ) | const |
Return the duration of the most-recent frame (time between last endFrame
and the previous start
, beginFrame
, or endFrame
).
Asserts if there are no frames.
double SurgSim::Framework::Timer::getLastFrameRate | ( | ) | const |
Return the inverse of the duration of the most-recent frame.
Asserts if there are no frames.
double SurgSim::Framework::Timer::getMaxFramePeriod | ( | ) | const |
size_t SurgSim::Framework::Timer::getMaxNumberOfFrames | ( | ) |
double SurgSim::Framework::Timer::getMinFramePeriod | ( | ) | const |
size_t SurgSim::Framework::Timer::getNumberOfClockFails | ( | ) | const |
start
. If this is non-zero, the frame durations may be incorrect. bool SurgSim::Framework::Timer::isBufferFull | ( | ) | const |