feisty meow concerns codebase  2.140
timely::stopwatch Class Reference

A class for measuring event durations in real time. More...

#include <stopwatch.h>

Inheritance diagram for timely::stopwatch:
Collaboration diagram for timely::stopwatch:

Public Member Functions

 stopwatch ()
 
 stopwatch (const stopwatch &to_copy)
 
virtual ~stopwatch ()
 
stopwatchoperator= (const stopwatch &to_copy)
 
void start ()
 Begins the timing. More...
 
void halt ()
 Stops the timing. More...
 
void stop ()
 a synonym for halt(). More...
 
void reset ()
 Stops the stopwatch and clears it to zero time elapsed. More...
 
int milliseconds ()
 Returns the elapsed number of milliseconds on the stopwatch, overall. More...
 
int elapsed ()
 a synonym for milliseconds(). More...
 

Detailed Description

A class for measuring event durations in real time.

Once the stopwatch is constructed, it can then be repeatedly started and halted, and then started again. The number of milliseconds or microseconds elapsed can be requested while the stopwatch is running, but that can disrupt fine-grained measurements.

Definition at line 28 of file stopwatch.h.

Constructor & Destructor Documentation

◆ stopwatch() [1/2]

timely::stopwatch::stopwatch ( )

Definition at line 26 of file stopwatch.cpp.

◆ stopwatch() [2/2]

timely::stopwatch::stopwatch ( const stopwatch to_copy)

Definition at line 33 of file stopwatch.cpp.

◆ ~stopwatch()

timely::stopwatch::~stopwatch ( )
virtual

Definition at line 40 of file stopwatch.cpp.

References basis::WHACK().

Member Function Documentation

◆ elapsed()

int timely::stopwatch::elapsed ( )
inline

a synonym for milliseconds().

Definition at line 54 of file stopwatch.h.

References milliseconds().

◆ halt()

void timely::stopwatch::halt ( )

Stops the timing.

start() may be called again to resume timing after the halt. If the stopwatch is already stopped, or never was started, then halt does nothing.

Definition at line 71 of file stopwatch.cpp.

Referenced by stop().

◆ milliseconds()

int timely::stopwatch::milliseconds ( )

Returns the elapsed number of milliseconds on the stopwatch, overall.

Definition at line 59 of file stopwatch.cpp.

Referenced by elapsed().

◆ operator=()

stopwatch & timely::stopwatch::operator= ( const stopwatch to_copy)

Definition at line 47 of file stopwatch.cpp.

◆ reset()

void timely::stopwatch::reset ( )

Stops the stopwatch and clears it to zero time elapsed.

Definition at line 57 of file stopwatch.cpp.

◆ start()

void timely::stopwatch::start ( )

Begins the timing.

If the stopwatch is already timing, then "start" does nothing.

Definition at line 61 of file stopwatch.cpp.

◆ stop()

void timely::stopwatch::stop ( )
inline

a synonym for halt().

Definition at line 46 of file stopwatch.h.

References halt().


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