The Pedigree Project 0.1
Public Member Functions | Private Attributes | List of all members
Time::Stopwatch Class Reference

#include <Stopwatch.h>

+ Collaboration diagram for Time::Stopwatch:

Public Member Functions

 Stopwatch (bool startRunning=false)
 
void start ()
 Start the stopwatch if it is not already started.
 
void stop ()
 Stop the stopwatch if it is not already stopped.
 
void reset ()
 Reset the stopwatch to zero.
 
Timestamp value ()
 Read the stopwatch value in nanoseconds.
 

Private Attributes

Timestamp m_Value
 Current value.
 
Timestamp m_StartValue
 Start time.
 
bool m_bRunning
 Running or not.
 

Detailed Description

Stopwatch provides a timer that can be stopped, started, and reset.

The value only ticks while the timer is running (it does not tick up during stop). The value is only current while the stopwatch is stopped.

Definition at line 32 of file Stopwatch.h.

Constructor & Destructor Documentation

◆ Stopwatch()

Time::Stopwatch::Stopwatch ( bool  startRunning = false)

Definition at line 25 of file Stopwatch.cc.

◆ ~Stopwatch()

Time::Stopwatch::~Stopwatch ( )
virtual

Definition at line 33 of file Stopwatch.cc.

Member Function Documentation

◆ reset()

void Time::Stopwatch::reset ( )

Reset the stopwatch to zero.

Definition at line 47 of file Stopwatch.cc.

◆ start()

void Time::Stopwatch::start ( )

Start the stopwatch if it is not already started.

Definition at line 35 of file Stopwatch.cc.

◆ stop()

void Time::Stopwatch::stop ( )

Stop the stopwatch if it is not already stopped.

Definition at line 40 of file Stopwatch.cc.

◆ value()

Timestamp Time::Stopwatch::value ( )

Read the stopwatch value in nanoseconds.

Definition at line 53 of file Stopwatch.cc.

Member Data Documentation

◆ m_bRunning

bool Time::Stopwatch::m_bRunning
private

Running or not.

Definition at line 57 of file Stopwatch.h.

◆ m_StartValue

Timestamp Time::Stopwatch::m_StartValue
private

Start time.

Definition at line 54 of file Stopwatch.h.

◆ m_Value

Timestamp Time::Stopwatch::m_Value
private

Current value.

Definition at line 51 of file Stopwatch.h.


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