22 static const double wcTimerConstants[4];
30 enum class TimeUnitType
38 StopWatch() : state(TimerState::stopped) {};
55 void storeLap(std::string
const& lapName);
76 virtual double getTimeElapsed(
const TimeUnitType unitType = TimeUnitType::milliSeconds);
86 void printTimeElapsed(std::string
const& name = std::string(
"noName"),
const TimeUnitType unitType = TimeUnitType::milliSeconds);
89 std::vector<double> lapTimes;
90 std::vector<std::string> lapNames;
91 std::chrono::high_resolution_clock::time_point wallClockTimeKeeper;
100 static const double cpuTimerConstants[4];
115 virtual void start()
override { cpuTimeKeeper = std::clock(); };
122 double getTimeElapsed(
const TimeUnitType unitType = TimeUnitType::milliSeconds)
override;
125 std::clock_t cpuTimeKeeper;
140 m_accumulatedTimer(0.),
159 void setEndPointOfUpdate();
164 unsigned int getUPS()
const {
return m_ups; }
unsigned int getUPS() const
Get the updates per second.
double getTotalLapTimes()
Returns the total time from all.
virtual void start()
Start the appropriate timer.
unsigned int m_ups
Most up-to-date ups.
void setStartPointOfUpdate()
Set the start point to the update.
double m_accumulatedTimer
Accumulated time (always < 1 sec)
UPSCounter()
Constructor/Destructor.
unsigned int m_updateCount
Current update count.
void printTimeElapsed(std::string const &name=std::string("noName"), const TimeUnitType unitType=TimeUnitType::milliSeconds)
Print the elapsed time.
virtual void stop()
Start the appropriate timer.
Stop Watch utility class.
static std::string getTimeAndDate()
Returns a string with current date and time in UTC.
virtual void start() override
Start the appropriate timer.
void printLapTimes()
Print all the lap times.
std::shared_ptr< StopWatch > m_timer
Timer.
Utility class to count updates per second.
virtual double getTimeElapsed(const TimeUnitType unitType=TimeUnitType::milliSeconds)
Returns the time elapsed since calling start.
virtual void reset()
Clears all the laps.