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

Class for storing sets of timers for profiling aspects of the simulation. More...

Public Member Functions

size_t addTimer (const ::std::string &label)
 Creates a lap timer which uses the given label for display. More...
 
size_t timerCount () const
 Reports the number of timers.
 
void start (size_t i)
 Starts the ith timer. More...
 
float elapsed (size_t i, float scale)
 Reports the time elapsed between this call and the last start for the ith timer. More...
 
float lap (size_t i, float scale)
 Reports the time elapsed from the previous call to lap() or start() to this call for the ith timer. The clock is still "running" and the next lap starts. More...
 
float average (size_t i, float scale)
 Reports the average lap time across all recorded laps for the ith timer. More...
 
int laps (size_t i)
 Reports the number of laps the ith counter has had. More...
 
void averages (size_t count, float scale, float *averages)
 Reports the average lap time across all recorded laps for the first "count" timers. More...
 
const ::std::string & displayString (size_t i)
 Returns the display string for the given LapTimer. More...
 

Static Public Member Functions

static ProfilergetInstance ()
 Returns a pointer to the singleton instance, creating it as necessary. More...
 

Detailed Description

Class for storing sets of timers for profiling aspects of the simulation.

Member Function Documentation

size_t Menge::Vis::Profiler::addTimer ( const ::std::string &  label)
inline

Creates a lap timer which uses the given label for display.

Parameters
labelThe string to display when reporting the profiling results.
Returns
The identifier for the created timer.
float Menge::Vis::Profiler::average ( size_t  i,
float  scale 
)
inline

Reports the average lap time across all recorded laps for the ith timer.

Parameters
iThe identifier for the timer. Only checked in debug mode.
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").
void Menge::Vis::Profiler::averages ( size_t  count,
float  scale,
float *  averages 
)
inline

Reports the average lap time across all recorded laps for the first "count" timers.

Parameters
countThe first count timers' average times will be reported. Only checked in debug mode.
scaleThe scale of the units to report the elapsed time in. e.g., 1.0 –> seconds, 0.001 –>, 1e-6 –> microseconds.
averagesA pointer to an array of floats sufficiently large to hold count values.
const ::std::string& Menge::Vis::Profiler::displayString ( size_t  i)
inline

Returns the display string for the given LapTimer.

Parameters
iThe index of the desired timer – only validated in debug mode.
Returns
The display string for the indicated LapTimer.
float Menge::Vis::Profiler::elapsed ( size_t  i,
float  scale 
)
inline

Reports the time elapsed between this call and the last start for the ith timer.

Parameters
iThe identifier for the timer. Only checked in debug mode.
scaleThe scale of the units to report the elapsed time in. e.g., 1.0 –> seconds, 0.001 –>, 1e-6 –> microseconds.
Returns
The elapsed time of the ith timer's last call (scaled by the given amount).
static Profiler* Menge::Vis::Profiler::getInstance ( )
inlinestatic

Returns a pointer to the singleton instance, creating it as necessary.

Returns
A pointer to the single instance of profiler
float Menge::Vis::Profiler::lap ( size_t  i,
float  scale 
)
inline

Reports the time elapsed from the previous call to lap() or start() to this call for the ith timer. The clock is still "running" and the next lap starts.

Parameters
iThe identifier for the timer. Only checked in debug mode.
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").
int Menge::Vis::Profiler::laps ( size_t  i)
inline

Reports the number of laps the ith counter has had.

Parameters
iThe identifier for the timer. Only checked in debug mode.
Returns
The number of laps.
void Menge::Vis::Profiler::start ( size_t  i)
inline

Starts the ith timer.

Parameters
iThe identifier for the timer. Only checked in debug mode.

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