Public Member Functions | Private Types | Private Attributes | List of all members
tesseract_common::Stopwatch Class Reference

A simple stopwatch class leveraging chrono high resolution clock. More...

#include <stopwatch.h>

Public Member Functions

double elapsedMilliseconds () const
 Get the elapsed time in milliseconds. More...
 
double elapsedSeconds () const
 Get the elapsed time in seconds. More...
 
void start ()
 Start the timer. More...
 
void stop ()
 Stop the timer. More...
 

Private Types

using Clock = std::chrono::steady_clock
 

Private Attributes

std::chrono::time_point< Clockend_time_
 
bool running_ { false }
 
std::chrono::time_point< Clockstart_time_
 

Detailed Description

A simple stopwatch class leveraging chrono high resolution clock.

Definition at line 37 of file stopwatch.h.

Member Typedef Documentation

◆ Clock

using tesseract_common::Stopwatch::Clock = std::chrono::steady_clock
private

Definition at line 39 of file stopwatch.h.

Member Function Documentation

◆ elapsedMilliseconds()

double tesseract_common::Stopwatch::elapsedMilliseconds ( ) const

Get the elapsed time in milliseconds.

If timer is actively running it will use Clock::now() as the end time

Returns
The elapsed time in milliseconds

Definition at line 43 of file stopwatch.cpp.

◆ elapsedSeconds()

double tesseract_common::Stopwatch::elapsedSeconds ( ) const

Get the elapsed time in seconds.

If timer is actively running it will use Clock::now() as the end time

Returns
The elapsed time in seconds

Definition at line 51 of file stopwatch.cpp.

◆ start()

void tesseract_common::Stopwatch::start ( )

Start the timer.

Definition at line 31 of file stopwatch.cpp.

◆ stop()

void tesseract_common::Stopwatch::stop ( )

Stop the timer.

Definition at line 37 of file stopwatch.cpp.

Member Data Documentation

◆ end_time_

std::chrono::time_point<Clock> tesseract_common::Stopwatch::end_time_
private

Definition at line 64 of file stopwatch.h.

◆ running_

bool tesseract_common::Stopwatch::running_ { false }
private

Definition at line 65 of file stopwatch.h.

◆ start_time_

std::chrono::time_point<Clock> tesseract_common::Stopwatch::start_time_
private

Definition at line 63 of file stopwatch.h.


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


tesseract_common
Author(s): Levi Armstrong
autogenerated on Sun May 18 2025 03:01:40