rippled
Loading...
Searching...
No Matches
Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
beast::io_latency_probe< Clock > Class Template Reference

Measures handler latency on an io_context queue. More...

#include <io_latency_probe.h>

Collaboration diagram for beast::io_latency_probe< Clock >:
Collaboration graph
[legend]

Classes

struct  sample_op
 

Public Member Functions

 io_latency_probe (duration const &period, boost::asio::io_context &ios)
 
 ~io_latency_probe ()
 
template<class Handler >
void sample_one (Handler &&handler)
 Measure one sample of i/o latency.
 
template<class Handler >
void sample (Handler &&handler)
 Initiate continuous i/o latency sampling.
 
boost::asio::io_context & get_io_context ()
 Return the io_context associated with the latency probe.
 
boost::asio::io_context const & get_io_context () const
 
void cancel ()
 Cancel all pending i/o.
 
void cancel_async ()
 

Private Types

using duration = typename Clock::duration
 
using time_point = typename Clock::time_point
 

Private Member Functions

void cancel (std::unique_lock< decltype(m_mutex)> &lock, bool wait)
 
void addref ()
 
void release ()
 

Private Attributes

std::recursive_mutex m_mutex
 
std::condition_variable_any m_cond
 
std::size_t m_count
 
duration const m_period
 
boost::asio::io_context & m_ios
 
boost::asio::basic_waitable_timer< std::chrono::steady_clockm_timer
 
bool m_cancel
 

Detailed Description

template<class Clock>
class beast::io_latency_probe< Clock >

Measures handler latency on an io_context queue.

Definition at line 19 of file io_latency_probe.h.

Member Typedef Documentation

◆ duration

template<class Clock >
using beast::io_latency_probe< Clock >::duration = typename Clock::duration
private

Definition at line 22 of file io_latency_probe.h.

◆ time_point

template<class Clock >
using beast::io_latency_probe< Clock >::time_point = typename Clock::time_point
private

Definition at line 23 of file io_latency_probe.h.

Constructor & Destructor Documentation

◆ io_latency_probe()

template<class Clock >
beast::io_latency_probe< Clock >::io_latency_probe ( duration const &  period,
boost::asio::io_context &  ios 
)

Definition at line 34 of file io_latency_probe.h.

◆ ~io_latency_probe()

template<class Clock >
beast::io_latency_probe< Clock >::~io_latency_probe ( )

Definition at line 43 of file io_latency_probe.h.

Member Function Documentation

◆ get_io_context() [1/2]

template<class Clock >
boost::asio::io_context & beast::io_latency_probe< Clock >::get_io_context ( )

Return the io_context associated with the latency probe.

Definition at line 52 of file io_latency_probe.h.

◆ get_io_context() [2/2]

template<class Clock >
boost::asio::io_context const & beast::io_latency_probe< Clock >::get_io_context ( ) const

Definition at line 58 of file io_latency_probe.h.

◆ cancel() [1/2]

template<class Clock >
void beast::io_latency_probe< Clock >::cancel ( )

Cancel all pending i/o.

Any handlers which have already been queued will still be called.

Definition at line 69 of file io_latency_probe.h.

◆ cancel_async()

template<class Clock >
void beast::io_latency_probe< Clock >::cancel_async ( )

Definition at line 76 of file io_latency_probe.h.

◆ sample_one()

template<class Clock >
template<class Handler >
void beast::io_latency_probe< Clock >::sample_one ( Handler &&  handler)

Measure one sample of i/o latency.

Handler will be called with this signature: void Handler (Duration d);

Definition at line 89 of file io_latency_probe.h.

◆ sample()

template<class Clock >
template<class Handler >
void beast::io_latency_probe< Clock >::sample ( Handler &&  handler)

Initiate continuous i/o latency sampling.

Handler will be called with this signature: void Handler (std::chrono::milliseconds);

Definition at line 106 of file io_latency_probe.h.

◆ cancel() [2/2]

template<class Clock >
void beast::io_latency_probe< Clock >::cancel ( std::unique_lock< decltype(m_mutex)> &  lock,
bool  wait 
)
private

Definition at line 119 of file io_latency_probe.h.

◆ addref()

template<class Clock >
void beast::io_latency_probe< Clock >::addref ( )
private

Definition at line 132 of file io_latency_probe.h.

◆ release()

template<class Clock >
void beast::io_latency_probe< Clock >::release ( )
private

Definition at line 139 of file io_latency_probe.h.

Member Data Documentation

◆ m_mutex

template<class Clock >
std::recursive_mutex beast::io_latency_probe< Clock >::m_mutex
private

Definition at line 25 of file io_latency_probe.h.

◆ m_cond

template<class Clock >
std::condition_variable_any beast::io_latency_probe< Clock >::m_cond
private

Definition at line 26 of file io_latency_probe.h.

◆ m_count

template<class Clock >
std::size_t beast::io_latency_probe< Clock >::m_count
private

Definition at line 27 of file io_latency_probe.h.

◆ m_period

template<class Clock >
duration const beast::io_latency_probe< Clock >::m_period
private

Definition at line 28 of file io_latency_probe.h.

◆ m_ios

template<class Clock >
boost::asio::io_context& beast::io_latency_probe< Clock >::m_ios
private

Definition at line 29 of file io_latency_probe.h.

◆ m_timer

template<class Clock >
boost::asio::basic_waitable_timer<std::chrono::steady_clock> beast::io_latency_probe< Clock >::m_timer
private

Definition at line 30 of file io_latency_probe.h.

◆ m_cancel

template<class Clock >
bool beast::io_latency_probe< Clock >::m_cancel
private

Definition at line 31 of file io_latency_probe.h.