join 1.0
lightweight network framework library
Loading...
Searching...
No Matches
join::BasicStats< ClockPolicy > Class Template Reference

lock-free, multi-producer-safe performance statistics collector. More...

#include <statistics.hpp>

Public Types

using Duration = typename ClockPolicy::Duration
 
using TimePoint = typename ClockPolicy::TimePoint
 

Public Member Functions

 BasicStats (const std::string &name={})
 create instance.
 
 BasicStats (const BasicStats &other)=delete
 copy constructor.
 
BasicStatsoperator= (const BasicStats &other)=delete
 copy assignment.
 
 BasicStats (BasicStats &&other)=delete
 move constructor.
 
BasicStatsoperator= (BasicStats &&other)=delete
 move assignment.
 
 ~BasicStats () noexcept
 destroy instance.
 
const std::string & name () const noexcept
 get metric name.
 
TimePoint start () const noexcept
 mark the beginning of a measured interval.
 
void stop (TimePoint startTime) noexcept
 mark the end of a measured interval and update all aggregates.
 
void reset () noexcept
 reset all accumulators to their initial state.
 
uint64_t count () const noexcept
 total number of completed intervals.
 
Duration last () const noexcept
 duration of the most recently completed interval.
 
Duration min () const noexcept
 minimum duration observed across all completed intervals.
 
Duration max () const noexcept
 maximum duration observed across all completed intervals.
 
std::chrono::duration< double, std::nano > mean () const noexcept
 arithmetic mean of all completed intervals.
 
double throughput () const noexcept
 operations per second.
 
Duration percentile (double p) const noexcept
 compute the requested percentile from the HDR histogram.
 
int mlock () const noexcept
 lock histogram memory in RAM.
 

Detailed Description

template<class ClockPolicy>
class join::BasicStats< ClockPolicy >

lock-free, multi-producer-safe performance statistics collector.

Member Typedef Documentation

◆ Duration

template<class ClockPolicy >
using join::BasicStats< ClockPolicy >::Duration = typename ClockPolicy::Duration

◆ TimePoint

template<class ClockPolicy >
using join::BasicStats< ClockPolicy >::TimePoint = typename ClockPolicy::TimePoint

Constructor & Destructor Documentation

◆ BasicStats() [1/3]

template<class ClockPolicy >
join::BasicStats< ClockPolicy >::BasicStats ( const std::string & name = {})
inlineexplicit

create instance.

Parameters
namemetric name.

◆ BasicStats() [2/3]

template<class ClockPolicy >
join::BasicStats< ClockPolicy >::BasicStats ( const BasicStats< ClockPolicy > & other)
delete

copy constructor.

Parameters
otherother object to copy.

◆ BasicStats() [3/3]

template<class ClockPolicy >
join::BasicStats< ClockPolicy >::BasicStats ( BasicStats< ClockPolicy > && other)
delete

move constructor.

Parameters
otherother object to move.

◆ ~BasicStats()

template<class ClockPolicy >
join::BasicStats< ClockPolicy >::~BasicStats ( )
inlinenoexcept

destroy instance.

Member Function Documentation

◆ count()

template<class ClockPolicy >
uint64_t join::BasicStats< ClockPolicy >::count ( ) const
inlinenoexcept

total number of completed intervals.

Returns
sample count.

◆ last()

template<class ClockPolicy >
Duration join::BasicStats< ClockPolicy >::last ( ) const
inlinenoexcept

duration of the most recently completed interval.

Returns
last measured duration.

◆ max()

template<class ClockPolicy >
Duration join::BasicStats< ClockPolicy >::max ( ) const
inlinenoexcept

maximum duration observed across all completed intervals.

Returns
maximum measured duration, or zero if no interval has been recorded.

◆ mean()

template<class ClockPolicy >
std::chrono::duration< double, std::nano > join::BasicStats< ClockPolicy >::mean ( ) const
inlinenoexcept

arithmetic mean of all completed intervals.

Returns
mean measured duration, or zero if no interval has been recorded.

◆ min()

template<class ClockPolicy >
Duration join::BasicStats< ClockPolicy >::min ( ) const
inlinenoexcept

minimum duration observed across all completed intervals.

Returns
minimum measured duration, or zero if no interval has been recorded.

◆ mlock()

template<class ClockPolicy >
int join::BasicStats< ClockPolicy >::mlock ( ) const
inlinenoexcept

lock histogram memory in RAM.

Returns
0 on success, -1 on failure.

◆ name()

template<class ClockPolicy >
const std::string & join::BasicStats< ClockPolicy >::name ( ) const
inlinenoexcept

get metric name.

Returns
metric name.

◆ operator=() [1/2]

template<class ClockPolicy >
BasicStats & join::BasicStats< ClockPolicy >::operator= ( BasicStats< ClockPolicy > && other)
delete

move assignment.

Parameters
otherother object to move.
Returns
a reference to the current object.

◆ operator=() [2/2]

template<class ClockPolicy >
BasicStats & join::BasicStats< ClockPolicy >::operator= ( const BasicStats< ClockPolicy > & other)
delete

copy assignment.

Parameters
otherother object to copy.
Returns
a reference to the current object.

◆ percentile()

template<class ClockPolicy >
Duration join::BasicStats< ClockPolicy >::percentile ( double p) const
inlinenoexcept

compute the requested percentile from the HDR histogram.

Parameters
ppercentile in [0.0, 100.0].
Returns
latency at the p-th percentile; zero if no samples have been recorded.

◆ reset()

template<class ClockPolicy >
void join::BasicStats< ClockPolicy >::reset ( )
inlinenoexcept

reset all accumulators to their initial state.

◆ start()

template<class ClockPolicy >
TimePoint join::BasicStats< ClockPolicy >::start ( ) const
inlinenoexcept

mark the beginning of a measured interval.

Returns
time point to be passed to the matching stop() call.

◆ stop()

template<class ClockPolicy >
void join::BasicStats< ClockPolicy >::stop ( TimePoint startTime)
inlinenoexcept

mark the end of a measured interval and update all aggregates.

Parameters
startTimetime point returned by the matching start() call.

◆ throughput()

template<class ClockPolicy >
double join::BasicStats< ClockPolicy >::throughput ( ) const
inlinenoexcept

operations per second.

Returns
throughput in ops/s.

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