0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Member Functions | Private Attributes | List of all members
Hypertable::Stopwatch Class Reference

The Stopwatch class measures elapsed time between instantiation (or a call to start) and a call to stop. More...

#include <Stopwatch.h>

Public Member Functions

 Stopwatch (bool start_running=true)
 Constructor; if start_running is true then the Stopwatch is started immediately. More...
 
void start ()
 Starts the Stopwatch. More...
 
void stop ()
 Stops the Stopwatch. More...
 
void reset ()
 Resets the Stopwatch. More...
 
double elapsed ()
 Returns the elapsed time. More...
 
int64_t elapsed_millis ()
 Returns elapsed time in milliseconds. More...
 

Private Attributes

bool m_running
 Flag whether the Stopwatch is currently running. More...
 
std::chrono::steady_clock::time_point start_time
 The start time. More...
 
std::chrono::steady_clock::duration elapsed_time {0}
 The elapsed time. More...
 

Detailed Description

The Stopwatch class measures elapsed time between instantiation (or a call to start) and a call to stop.

Definition at line 40 of file Stopwatch.h.

Constructor & Destructor Documentation

Hypertable::Stopwatch::Stopwatch ( bool  start_running = true)
inline

Constructor; if start_running is true then the Stopwatch is started immediately.

Definition at line 44 of file Stopwatch.h.

Member Function Documentation

double Hypertable::Stopwatch::elapsed ( )
inline

Returns the elapsed time.

Can be called while the Stopwatch is running; in this case the Stopwatch will continue to run.

Definition at line 72 of file Stopwatch.h.

int64_t Hypertable::Stopwatch::elapsed_millis ( )
inline

Returns elapsed time in milliseconds.

Returns
Elapsed time in milliseconds.

Definition at line 84 of file Stopwatch.h.

void Hypertable::Stopwatch::reset ( )
inline

Resets the Stopwatch.

Definition at line 66 of file Stopwatch.h.

void Hypertable::Stopwatch::start ( )
inline

Starts the Stopwatch.

Definition at line 50 of file Stopwatch.h.

void Hypertable::Stopwatch::stop ( )
inline

Stops the Stopwatch.

Has no effect if the Stopwatch was not running.

Definition at line 58 of file Stopwatch.h.

Member Data Documentation

std::chrono::steady_clock::duration Hypertable::Stopwatch::elapsed_time {0}
private

The elapsed time.

Definition at line 100 of file Stopwatch.h.

bool Hypertable::Stopwatch::m_running
private

Flag whether the Stopwatch is currently running.

Definition at line 94 of file Stopwatch.h.

std::chrono::steady_clock::time_point Hypertable::Stopwatch::start_time
private

The start time.

Definition at line 97 of file Stopwatch.h.


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