Switchboard SDK
Loading...
Searching...
No Matches
switchboard::Stopwatch Class Reference

Can be used to measure code execution performance. More...

#include <Stopwatch.hpp>

Public Member Functions

 Stopwatch ()
 Creates a Stopwatch instance.
 
void start ()
 Starts the measurement.
 
std::chrono::microseconds stop ()
 Stops the measurement.
 
void reset ()
 Resets the stopwatch.
 
std::chrono::microseconds getMaxValue () const
 Returns that maximum value that was measured by the stopwatch instance.
 
std::chrono::microseconds getMinValue () const
 Returns that minimum value that was measured by the stopwatch instance.
 
std::chrono::microseconds getAverageValue () const
 Returns that average value that was measured by the stopwatch instance.
 
uint getNumberOfMeasurements () const
 Returns the number of measurements that was made by the stopwatch instance.
 
void logReport () const
 Logs an info level message about the measured values.
 

Detailed Description

Can be used to measure code execution performance.

Stopwatch class.

Member Function Documentation

◆ getAverageValue()

microseconds switchboard::Stopwatch::getAverageValue ( ) const

Returns that average value that was measured by the stopwatch instance.

Returns
The average measured value in microseconds.

◆ getMaxValue()

microseconds switchboard::Stopwatch::getMaxValue ( ) const

Returns that maximum value that was measured by the stopwatch instance.

Returns
The maximum measured value in microseconds.

◆ getMinValue()

microseconds switchboard::Stopwatch::getMinValue ( ) const

Returns that minimum value that was measured by the stopwatch instance.

Returns
The minimum measured value in microseconds.

◆ getNumberOfMeasurements()

uint switchboard::Stopwatch::getNumberOfMeasurements ( ) const

Returns the number of measurements that was made by the stopwatch instance.

Returns
The number of measurements.

◆ reset()

void switchboard::Stopwatch::reset ( )

Resets the stopwatch.

Clears all data about previous measurements.

◆ stop()

microseconds switchboard::Stopwatch::stop ( )

Stops the measurement.

Returns
The elapsed microseconds between the last start and stop calls.