1#ifndef ROBOTOC_UTILS_TIMER_HPP_
2#define ROBOTOC_UTILS_TIMER_HPP_
30 void tick() { tick_ = std::chrono::high_resolution_clock::now(); }
35 void tock() { tock_ = std::chrono::high_resolution_clock::now(); }
42 const std::chrono::duration<double, std::ratio<1, 1>> timing = tock_ - tick_;
43 return timing.count();
50 const std::chrono::duration<double, std::milli> timing = tock_ - tick_;
51 return timing.count();
58 const std::chrono::duration<double, std::nano> timing = tock_ - tick_;
59 return timing.count();
63 std::chrono::high_resolution_clock::time_point tick_, tock_;
A timer class to take benchmarks.
Definition: timer.hpp:12
double s() const
Returns the time duration (seconds) from tick() to tock().
Definition: timer.hpp:41
double ns() const
Returns the time duration (nano seconds) from tick() to tock().
Definition: timer.hpp:57
void tick()
Takes a time clock.
Definition: timer.hpp:30
void tock()
Takes a time clock.
Definition: timer.hpp:35
~Timer()=default
Default destructor.
Timer()
Default constructor.
Definition: timer.hpp:17
double ms() const
Returns the time duration (milli seconds) from tick() to tock().
Definition: timer.hpp:49
Definition: constraint_component_base.hpp:17