mrs_lib
Various reusable classes, functions and utilities for use in MRS projects
Loading...
Searching...
No Matches
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 rclcpp::Node::SharedPtr &node, const std::string &label, const rclcpp::Duration &throttle_period=rclcpp::Duration(0, 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 rclcpp::Node::SharedPtr &node, const std::string &label, const time_point &tp0, const rclcpp::Duration &throttle_period=rclcpp::Duration(0, 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 rclcpp::Node::SharedPtr &node, 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.
 ~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:
  • /home/runner/work/mrs_lib/mrs_lib/include/mrs_lib/scope_timer.h
  • /home/runner/work/mrs_lib/mrs_lib/src/scope_timer/scope_timer.cpp