#include <FrameTimer.h>
Public Member Functions | |
FrameTimer (unsigned int maxNumberIntervals=10) | |
virtual | ~FrameTimer (void) |
void | start () |
void | end () |
virtual unsigned long | getCurrentTime ()=0 |
virtual double | calculateFrameRate ()=0 |
unsigned long | getStartTime () |
Protected Attributes | |
unsigned long | startTime |
unsigned long | endTime |
double | averageInterval |
unsigned int | maxIntervals |
unsigned long | sumIntervals |
std::queue< unsigned long > | intervals |
This class was devised from the frame rate calculation mechanism used in the TabletopVis class of the original implementation of the framework by A. Miede and T. Isenberg in the Interactions Lab at the University of Calgary, Canada.
FrameTimer::FrameTimer | ( | unsigned int | maxNumberIntervals = 10 |
) |
Constructs this frame timer object. If no value is given to the maximum number of intervals, a defualt value of 10 is used.
maxNumberIntervals | the value to be set as the maximum number of intervals in the average calcualtions. |
FrameTimer::~FrameTimer | ( | void | ) | [virtual] |
Destroys this frame timer object.
void FrameTimer::start | ( | ) |
Starts measuring an interval.
void FrameTimer::end | ( | ) |
Ends measuring an interval.
virtual unsigned long FrameTimer::getCurrentTime | ( | ) | [pure virtual] |
Returns the current system time. It is platform dependent and should be implement by a subclass.
virtual double FrameTimer::calculateFrameRate | ( | ) | [pure virtual] |
Calculates the frame per seconds value based on what unit is used to measure the system time in the used platform (e.g., msecs, clock ticks, etc.). It should use the value of the averageInterval attribute in its calculations.
unsigned long FrameTimer::getStartTime | ( | ) | [inline] |
Returns the start time of the current interval being measured.
unsigned long FrameTimer::startTime [protected] |
The start time of the interval being measured.
unsigned long FrameTimer::endTime [protected] |
The end time of the interval being measured.
double FrameTimer::averageInterval [protected] |
The average of the intervals being measured.
unsigned int FrameTimer::maxIntervals [protected] |
The maximum number of intervals to be considered.
unsigned long FrameTimer::sumIntervals [protected] |
The sum of all interval values.
std::queue<unsigned long> FrameTimer::intervals [protected] |
The queue of interval values used to calculate the average value.