Loading [MathJax]/extensions/tex2jax.js
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
PLMD::Stopwatch::Watch Class Reference

Class to store a single stopwatch. More...

#include <Stopwatch.h>

Public Member Functions

long long int getLastCycle () noexcept
 returns the time for the last cycle
 
long long int getTotal () noexcept
 returns the total time
 
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.
 
long long int lastLap = 0
 last lap
 
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

◆ getLastCycle()

long long int PLMD::Stopwatch::Watch::getLastCycle ( )
inlinenoexcept

returns the time for the last cycle

◆ getTotal()

long long int PLMD::Stopwatch::Watch::getTotal ( )
inlinenoexcept

returns the total time

◆ 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

Friends And Related Symbol Documentation

◆ 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.

◆ lastLap

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

last lap

◆ 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: