Menge
Modular Pedestrian Simulation Framework for Research and Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Attributes | List of all members
Menge::Vis::SampleTimer Class Reference

A timer which uses a cache of values to only update its values every N calls to lap/elapsed. Useful for displaying frame rate. More...

#include <Profiler.h>

Inheritance diagram for Menge::Vis::SampleTimer:
Menge::Vis::Timer

Public Member Functions

 SampleTimer (int sampleCount)
 Constructor. More...
 
float lap (float scale=1.f)
 Reports the average elapsed time of the last N calls to lap. More...
 
- Public Member Functions inherited from Menge::Vis::Timer
 Timer ()
 Default constructor.
 
void start ()
 Starts the timer running.
 
float elapsed (float scale)
 Reports the time elapsed between this call and the last start. More...
 

Protected Attributes

int _totalSamples
 The number of samples to compute the average over.
 
int _currSample
 The curren total number of calls to lap.
 
float _total
 The current accrual of time for the current cache (in seconds).
 
float _cached
 The most recently defined elapsed lap time.
 
- Protected Attributes inherited from Menge::Vis::Timer
struct timespec _start
 The time (in clock cycles) at which the timer was started.
 

Detailed Description

A timer which uses a cache of values to only update its values every N calls to lap/elapsed. Useful for displaying frame rate.

Constructor & Destructor Documentation

Menge::Vis::SampleTimer::SampleTimer ( int  sampleCount)

Constructor.

Parameters
sampleCountThe number of repeated calls to lap to cause the timer to report a new, average value.

Member Function Documentation

float Menge::Vis::SampleTimer::lap ( float  scale = 1.f)

Reports the average elapsed time of the last N calls to lap.

Parameters
scaleThe scale of the units to report the elapsed time in. e.g., 1.0 –> seconds, 0.001 –>, 1e-6 –> microseconds.
Returns
The time elapsed (for units see "scale").

The documentation for this class was generated from the following files: