hexed 0.4.0
 
Loading...
Searching...
No Matches
hexed::Stopwatch Class Reference

A class for conveniently measuring execution time. More...

#include <Stopwatch.hpp>

Classes

class  Operator
 RAII-style operation of a stopwatch. More...
 

Public Member Functions

void start ()
 Starts measuring time.
 
void pause ()
 pauses measurement and updates time()
 
void reset ()
 resets time() to zero
 
bool running () const
 false if the stopwatch has been stopped since the last time it was started
 
int n_calls () const
 number of times the stopwatch has been stopped.
 
double time () const
 time currently on the stopwatch
 
Stopwatch operator+ (Stopwatch other) const
 
Stopwatchoperator+= (Stopwatch other)
 adds time and n_calls, throws if either is running
 

Detailed Description

A class for conveniently measuring execution time.

Measures wall clock time. Can be started and stopped multiple times.

Member Function Documentation

◆ pause()

void hexed::Stopwatch::pause ( )

pauses measurement and updates time()

Throws an exception if not running.

◆ start()

void hexed::Stopwatch::start ( )

Starts measuring time.

Throws an exception if already running.

◆ time()

double hexed::Stopwatch::time ( ) const

time currently on the stopwatch

Specifically, the total elapsed time between start()s and stop()s since the last reset(), plus time since last start() if running().


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