Loading...
Searching...
No Matches
PLMD::Stopwatch::Watch Class Reference

Class to store a single stopwatch. More...

#include <Stopwatch.h>

Public Member Functions

Watchpause ()
 pause the watch
Watchstart ()
 start the watch
Handler startPause ()
 returns a start-pause handler
Handler startStop ()
 returns a start-stop handler
Watchstop ()
 stop the watch

Private Types

enum class  State { started , stopped , paused }

Private Attributes

unsigned cycles = 0
 Total number of cycles.
long long int lap = 0
 Accumulated time for this lap, in nanoseconds.
std::chrono::time_point< std::chrono::high_resolution_clock > lastStart
 Instant in time when Watch was started last time.
long long int max = 0
 Slowest lap so far, in nanoseconds.
long long int min = 0
 Fastest lap so far, in nanoseconds.
unsigned running = 0
 count how many times Watch was started (+1) or stopped/paused (-1).
State state = State::stopped
 keep track of state
long long int total = 0
 Total accumulated time, in nanoseconds.

Friends

class Stopwatch
 Allows access to internal data.

Detailed Description

Class to store a single stopwatch.

Class Stopwatch contains a collection of them

Member Enumeration Documentation

◆ State

enum class PLMD::Stopwatch::Watch::State
strongprivate
Enumerator
started 
stopped 
paused 

Member Function Documentation

◆ pause()

Stopwatch::Watch & PLMD::Stopwatch::Watch::pause ( )
inline

pause the watch

◆ start()

Stopwatch::Watch & PLMD::Stopwatch::Watch::start ( )
inline

start the watch

◆ startPause()

Stopwatch::Handler PLMD::Stopwatch::Watch::startPause ( )
inline

returns a start-pause handler

◆ startStop()

Stopwatch::Handler PLMD::Stopwatch::Watch::startStop ( )
inline

returns a start-stop handler

◆ stop()

Stopwatch::Watch & PLMD::Stopwatch::Watch::stop ( )
inline

stop the watch

◆ Stopwatch

friend class Stopwatch
friend

Allows access to internal data.

Member Data Documentation

◆ cycles

unsigned PLMD::Stopwatch::Watch::cycles = 0
private

Total number of cycles.

◆ lap

long long int PLMD::Stopwatch::Watch::lap = 0
private

Accumulated time for this lap, in nanoseconds.

◆ lastStart

std::chrono::time_point<std::chrono::high_resolution_clock> PLMD::Stopwatch::Watch::lastStart
private

Instant in time when Watch was started last time.

◆ max

long long int PLMD::Stopwatch::Watch::max = 0
private

Slowest lap so far, in nanoseconds.

◆ min

long long int PLMD::Stopwatch::Watch::min = 0
private

Fastest lap so far, in nanoseconds.

◆ running

unsigned PLMD::Stopwatch::Watch::running = 0
private

count how many times Watch was started (+1) or stopped/paused (-1).

◆ state

State PLMD::Stopwatch::Watch::state = State::stopped
private

keep track of state

◆ total

long long int PLMD::Stopwatch::Watch::total = 0
private

Total accumulated time, in nanoseconds.


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