FrameTimer Class Reference

#include <FrameTimer.h>

List of all members.

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


Detailed Description

This class measures the time spent during an interval and adds it to a queue so that the average time for a given number of measurements can be calculated. This is meant to be used to calculate the frame rate when rendering components in the UofC Large Display Framework. The methods for obtaining the system time, which are platform specific, should be implemented by subclasses provided by the application.

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.

Author:
Fabricio Anastacio - fabriciocfa@yahoo.com
Since:
July 26, 2007


Constructor & Destructor Documentation

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.

Parameters:
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.


Member Function Documentation

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.

Returns:
the current system time.

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.

Returns:
the fps value based on the current interval values.

unsigned long FrameTimer::getStartTime (  )  [inline]

Returns the start time of the current interval being measured.

Returns:
the start time of the current interval being measured.


Member Data Documentation

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.


The documentation for this class was generated from the following files:
Generated on Fri Dec 21 17:43:49 2007 for LargeDisplayFramework by  doxygen 1.5.2