mrs_lib
Various reusable classes, functions and utilities for use in MRS projects
mrs_lib::ScopeTimer Class Reference

Simple timer which will time a duration of a scope and checkpoints inside the scope in ros time and std::chrono time. More...

#include <scope_timer.h>

Classes

struct  time_point
 

Public Member Functions

 ScopeTimer (const std::string &label, const ros::Duration &throttle_period=ros::Duration(0), const bool enable=true, const std::shared_ptr< ScopeTimerLogger > scope_timer_logger=nullptr)
 The basic constructor with a user-defined label of the timer, throttled period and file logger.
 
 ScopeTimer (const std::string &label, const time_point &tp0, const ros::Duration &throttle_period=ros::Duration(0), const bool enable=true, const std::shared_ptr< ScopeTimerLogger > scope_timer_logger=nullptr)
 The basic constructor with a user-defined label of the timer and a pre-start time, which will also be measured.
 
 ScopeTimer (const std::string &label, const std::shared_ptr< ScopeTimerLogger > scope_timer_logger, const bool enable=true)
 The basic constructor with a user-defined label of the timer and file logger.
 
void checkpoint (const std::string &label)
 Checkpoint, prints the time passed until the point this function is called.
 
float getLifetime ()
 Getter for scope timer lifetime. More...
 
 ~ScopeTimer ()
 The basic destructor which prints out or logs the scope times, if enabled.
 

Detailed Description

Simple timer which will time a duration of a scope and checkpoints inside the scope in ros time and std::chrono time.

Member Function Documentation

◆ getLifetime()

float mrs_lib::ScopeTimer::getLifetime ( )

Getter for scope timer lifetime.

Returns
lifetime as floating point milliseconds

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