16 #ifndef SURGSIM_FRAMEWORK_TIMER_H 17 #define SURGSIM_FRAMEWORK_TIMER_H 19 #include <boost/chrono.hpp> 20 #include <boost/thread/shared_mutex.hpp> 105 TimerTimePoint
now();
Definition: CompoundShapeToGraphics.cpp:29
Timer()
Instantiate a TimerClock and start a timing run.
Definition: Timer.cpp:24
size_t m_clockFails
Number of clock errors since last start.
Definition: Timer.h:123
double getCumulativeTime() const
Return the sum of the durations over all the stored frames.
Definition: Timer.cpp:66
size_t m_maxNumberOfFrames
Maximum number of frames to store.
Definition: Timer.h:114
std::deque< TimerDuration > m_frameDurations
Durations of the frames, i.e., the "stored frames".
Definition: Timer.h:117
double getAverageFrameRate() const
Return the inverse of the average duration across all stored frames.
Definition: Timer.cpp:98
boost::chrono::time_point< TimerClock, TimerDuration > TimerTimePoint
Time points used by the Timer class.
Definition: Timer.h:101
boost::chrono::duration< double > TimerDuration
Durations used by the Timer class.
Definition: Timer.h:98
Timer class, measures execution times.
Definition: Timer.h:30
size_t getCurrentNumberOfFrames() const
Definition: Timer.cpp:134
double getMaxFramePeriod() const
Definition: Timer.cpp:157
double getLastFrameRate() const
Return the inverse of the duration of the most-recent frame.
Definition: Timer.cpp:112
double getLastFramePeriod() const
Return the duration of the most-recent frame (time between last endFrame and the previous start...
Definition: Timer.cpp:103
void setMaxNumberOfFrames(size_t numberOfFrames)
Set the maximum number of frames to store.
Definition: Timer.cpp:117
boost::shared_mutex m_sharedMutex
Mutex to access the data structure m_frameDurations safely.
Definition: Timer.h:120
void start()
Begin a timing run by clearing out any stored frames and beginning a frame.
Definition: Timer.cpp:30
void endFrame()
End this frame by storing the duration since the current frame was begun.
Definition: Timer.cpp:45
TimerTimePoint m_lastTime
The time at last start, beginFrame, or markFrame.
Definition: Timer.h:111
double getMinFramePeriod() const
Definition: Timer.cpp:166
size_t getNumberOfClockFails() const
Definition: Timer.cpp:141
static const TimerClock m_clock
The clock used to get the time.
Definition: Timer.h:108
bool isBufferFull() const
Definition: Timer.cpp:175
boost::chrono::steady_clock TimerClock
The Clock used by the Timer class.
Definition: Timer.h:95
size_t getMaxNumberOfFrames()
Definition: Timer.cpp:129
TimerTimePoint now()
Get the current time.
Definition: Timer.cpp:146
double getAverageFramePeriod() const
Return the average duration across all stored frames.
Definition: Timer.cpp:80
void markFrame()
End the current frame and begin a new frame.
Definition: Timer.cpp:60
void beginFrame()
Begin a frame (storing the current time).
Definition: Timer.cpp:40