44 #ifndef __PROFILER_H__
45 #define __PROFILER_H__
54 #include "include/macros.h"
100 struct timespec _start;
127 float lap(
float scale=1.f );
136 float average(
float scale=1.f );
185 float lap(
float scale=1.f );
227 size_t addTimer(
const std::string & displayString );
271 void setUnits(
float scale,
const std::string & unitString );
273 #else // not defined TIME_CROWD
275 #define addTimer( displayString ) (0)
276 #define startTimer( index )
277 #define stopTimer( index )
278 #define lapTimer( index )
279 #define averageTime( index )
280 #define printAverages()
281 #define setUnits( scale, unitString )
287 #endif // __PROFILER_H__
The core namespace. All elements of Menge are contained in this namespace.
Definition: AgentGenerator.cpp:43
Basic timer.
Definition: Profiler.h:63
int _lapCount
The total number of calls to lap()
Definition: Profiler.h:159
void printAverages()
Prints the average times for all timers, displayed with the accompanying messages and set units...
Definition: Profiler.cpp:423
Timer()
Default constructor.
Definition: Profiler.cpp:85
Lap timer. A timer which supports "laps" i.e., single calls which measure from the last "tick" to thi...
Definition: Profiler.h:112
The namespace containing visualization functionality for the pedestrian simulation.
Definition: GLViewer.h:64
SampleTimer(int sampleCount)
Constructor.
Definition: Profiler.cpp:160
int _currSample
The curren total number of calls to lap.
Definition: Profiler.h:196
void lapTimer(size_t index)
Lap the ith timer.
Definition: Profiler.cpp:410
void startTimer(size_t index)
Starts the timer with the given identifier.
Definition: Profiler.cpp:398
float elapsed(float scale)
Reports the time elapsed between this call and the last start.
Definition: Profiler.cpp:96
float average(float scale=1.f)
Reports the average lap time across all recorded laps.
Definition: Profiler.cpp:148
void start()
Starts the timer running.
Definition: Profiler.cpp:90
int laps() const
Reports the number of calls to laps.
Definition: Profiler.h:141
A timer which uses a cache of values to only update its values every N calls to lap/elapsed. Useful for displaying frame rate.
Definition: Profiler.h:168
float _cached
The most recently defined elapsed lap time.
Definition: Profiler.h:213
float _total
The current accrual of time for the current cache (in seconds).
Definition: Profiler.h:207
void setUnits(float scale, const std::string &unitString)
Sets the internal units of the profiler.
Definition: Profiler.cpp:435
void stopTimer(size_t index)
Stops the timer with the given identifier.
Definition: Profiler.cpp:404
LapTimer()
Default constructor.
Definition: Profiler.cpp:108
double _total
The total accrued time of timed intervals (in seconds).
Definition: Profiler.h:153
float lap(float scale=1.f)
Reports the time elapsed from the previous call to lap() or start() to this call. The clock is still ...
Definition: Profiler.cpp:137
float lap(float scale=1.f)
Reports the average elapsed time of the last N calls to lap.
Definition: Profiler.cpp:183
struct timespec _start
The time (in clock cycles) at which the timer was started.
Definition: Profiler.h:100
size_t addTimer(const std::string &displayString)
Creates a lap timer which uses the given label for display.
Definition: Profiler.cpp:392
float averageTime(size_t index)
Reports the average time of the ith timer.
Definition: Profiler.cpp:416
int _totalSamples
The number of samples to compute the average over.
Definition: Profiler.h:191