XRootD
XrdCephBuffer::Timer_ns Class Reference

#include <BufferUtils.hh>

+ Collaboration diagram for XrdCephBuffer::Timer_ns:

Public Member Functions

 Timer_ns (long &output_ns)
 RAII based timer information outputing a long value of ns Almost trivial class to time something and to pass the duration as a long to an output variable (specified in the constructor) at destruction. Create the object to start the timer. The timer stops when its destructor is called. #TODO improve to template the output type and the time ratio. More...
 
 ~Timer_ns ()
 

Detailed Description

Definition at line 32 of file BufferUtils.hh.

Constructor & Destructor Documentation

◆ Timer_ns()

Timer_ns::Timer_ns ( long &  output_ns)
explicit

RAII based timer information outputing a long value of ns Almost trivial class to time something and to pass the duration as a long to an output variable (specified in the constructor) at destruction. Create the object to start the timer. The timer stops when its destructor is called. #TODO improve to template the output type and the time ratio.

Definition at line 160 of file BufferUtils.cc.

160  : m_output_val(output)
161 {
162  m_start = std::chrono::steady_clock::now();
163 }

◆ ~Timer_ns()

Timer_ns::~Timer_ns ( )

Definition at line 165 of file BufferUtils.cc.

166 {
167  auto end = std::chrono::steady_clock::now();
168  m_output_val = std::chrono::duration_cast<std::chrono::nanoseconds>(end - m_start).count();
169 }

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