10 #define STOPWATCH_HPP_ 
   58 #ifndef BOOSTERSEAT_NO_EXCEPTION 
   72 #ifndef BOOSTERSEAT_NO_EXCEPTION 
  101     return std::chrono::duration_cast<clck::units::Microseconds>(
getElapsed())
 
  106     return std::chrono::duration_cast<clck::units::Microseconds>(
getElapsed())
 
  112     return std::chrono::duration_cast<clck::units::Milliseconds>(
getElapsed())
 
  117     return std::chrono::duration_cast<clck::units::Milliseconds>(
getElapsed())
 
  123     return std::chrono::duration_cast<clck::units::Seconds>(
getElapsed())
 
  129     return std::chrono::duration_cast<clck::units::Seconds>(
getElapsed())
 
  175 #ifndef BOOSTERSEAT_NO_EXCEPTION 
  188 #ifndef BOOSTERSEAT_NO_EXCEPTION 
  245   void tick(int64_t microseconds) {
 
Definition: exception.hpp:99
 
Definition: stopwatch.hpp:17
 
virtual int64_t elapsedSeconds() const =0
 
virtual int64_t elapsedMicroseconds() const =0
 
virtual double elapsedSecondsF() const =0
 
State
The state of the stopwatch.
Definition: stopwatch.hpp:35
 
virtual ~IStopwatch()=default
 
virtual double elapsedMillisecondsF() const =0
 
virtual double elapsedMicrosecondsF() const =0
 
virtual int64_t elapsedMilliseconds() const =0
 
virtual bool isRunning() const =0
 
State state_
The state of the stopwatch.
Definition: stopwatch.hpp:38
 
virtual void reset(bool stop=true)=0
 
A manually controlled stopwatch that does not use the system clock.
Definition: stopwatch.hpp:165
 
int64_t elapsed_
Definition: stopwatch.hpp:261
 
void start()
Definition: stopwatch.hpp:170
 
int64_t elapsedMicroseconds() const
Definition: stopwatch.hpp:207
 
double elapsedMillisecondsF() const
Definition: stopwatch.hpp:219
 
double elapsedSecondsF() const
Definition: stopwatch.hpp:227
 
int64_t elapsedMilliseconds() const
Definition: stopwatch.hpp:215
 
void tickIfRunning(int64_t microseconds)
Definition: stopwatch.hpp:239
 
void pause()
Definition: stopwatch.hpp:231
 
bool isRunning() const
Definition: stopwatch.hpp:203
 
State state_
Definition: stopwatch.hpp:262
 
int64_t getElapsed() const
Definition: stopwatch.hpp:250
 
void stop()
Definition: stopwatch.hpp:182
 
double elapsedMicrosecondsF() const
Definition: stopwatch.hpp:211
 
int64_t stop_time_
Definition: stopwatch.hpp:260
 
int64_t start_
Definition: stopwatch.hpp:259
 
void resume()
Definition: stopwatch.hpp:235
 
~SoftwareStopwatch()=default
 
int64_t elapsedSeconds() const
Definition: stopwatch.hpp:223
 
void reset(bool stop=true)
Definition: stopwatch.hpp:195
 
void tick(int64_t microseconds)
Definition: stopwatch.hpp:245
 
SoftwareStopwatch()=default
 
A simple stopwatch class. Basic start (resume), stop (pause), and reset functionality.
Definition: stopwatch.hpp:43
 
int64_t elapsedMicroseconds() const
Get the elapsed time in microseconds.
Definition: stopwatch.hpp:100
 
double elapsedSecondsF() const
Get the elapsed time in seconds in a floating point format.
Definition: stopwatch.hpp:128
 
clck::TimePoint stop_time_
Definition: stopwatch.hpp:159
 
void reset(bool stop=true)
Resets the elapsed time. The stopwatch will keep running by default.
Definition: stopwatch.hpp:82
 
clck::Duration elapsed_
Definition: stopwatch.hpp:160
 
bool isRunning() const
Returns the current state of the stopwatch.
Definition: stopwatch.hpp:92
 
double elapsedMillisecondsF() const
Get the elapsed time in milliseconds in a floating point format.
Definition: stopwatch.hpp:116
 
void resume()
alias for start() as it does what you want it to do.
Definition: stopwatch.hpp:141
 
clck::Clock clock_
Definition: stopwatch.hpp:157
 
~Stopwatch()=default
Default destructor.
 
Stopwatch()=default
Construct a new Stopwatch object. The stopwatch is stopped.
 
void pause()
alias for stop() as it does what you want it to do.
Definition: stopwatch.hpp:136
 
void start()
Start the stopwatch.
Definition: stopwatch.hpp:53
 
clck::TimePoint start_
Definition: stopwatch.hpp:158
 
State state_
Definition: stopwatch.hpp:161
 
Scale
The resolution/scale of the time returned by elapsed()
Definition: stopwatch.hpp:97
 
void stop()
Stops/Pauses the stopwatch. Does not reset the elapsed time.
Definition: stopwatch.hpp:66
 
int64_t elapsedMilliseconds() const
Get the elapsed time in milliseconds.
Definition: stopwatch.hpp:111
 
double elapsedMicrosecondsF() const
Get the elapsed time in microseconds in a floating point format.
Definition: stopwatch.hpp:105
 
int64_t elapsedSeconds() const
Get the elapsed time in seconds.
Definition: stopwatch.hpp:122
 
bst::clck::Duration getElapsed() const
Handles the timekeeping.
Definition: stopwatch.hpp:148
 
std::chrono::time_point< Clock > TimePoint
Definition: clock.hpp:16
 
std::chrono::high_resolution_clock Clock
Definition: clock.hpp:15
 
Clock::duration Duration
Definition: clock.hpp:17
 
Definition: filesystem.cpp:34