rippled
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_service queue. More...

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_service &ios)
 
 ~io_latency_probe ()
 
template<class Handler >
void sample_one (Handler &&handler)
 Measure one sample of i/o latency. More...
 
template<class Handler >
void sample (Handler &&handler)
 Initiate continuous i/o latency sampling. More...
 
boost::asio::io_service & get_io_service ()
 Return the io_service associated with the latency probe. More...
 
boost::asio::io_service const & get_io_service () const
 
void cancel ()
 Cancel all pending i/o. More...
 
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
 
const duration m_period
 
boost::asio::io_service & 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_service queue.

Definition at line 34 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 37 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 38 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_service &  ios 
)

Definition at line 49 of file io_latency_probe.h.

◆ ~io_latency_probe()

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

Definition at line 58 of file io_latency_probe.h.

Member Function Documentation

◆ get_io_service() [1/2]

template<class Clock >
boost::asio::io_service& beast::io_latency_probe< Clock >::get_io_service ( )

Return the io_service associated with the latency probe.

Definition at line 67 of file io_latency_probe.h.

◆ get_io_service() [2/2]

template<class Clock >
boost::asio::io_service const& beast::io_latency_probe< Clock >::get_io_service ( ) const

Definition at line 73 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 84 of file io_latency_probe.h.

◆ cancel_async()

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

Definition at line 91 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 104 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 119 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 130 of file io_latency_probe.h.

◆ addref()

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

Definition at line 143 of file io_latency_probe.h.

◆ release()

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

Definition at line 150 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 40 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 41 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 42 of file io_latency_probe.h.

◆ m_period

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

Definition at line 43 of file io_latency_probe.h.

◆ m_ios

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

Definition at line 44 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 45 of file io_latency_probe.h.

◆ m_cancel

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

Definition at line 46 of file io_latency_probe.h.