libjmmcg  build_2783
A C++ library containing an eclectic mix of useful, advanced components.
jmmcg::ave_deviation_meter< MeteredObjType > Class Template Reference

A class used to compute the arithmetic mean and mean-average deviation [1] of a series of events. More...

#include <ave_deviation_meter.hpp>

Public Types

using atomic_counter_type = ppd::atomic_ctr< MeteredObjType, ppd::api_lock_traits< ppd::platform_api, ppd::sequential_mode > >
 
using value_type = typename atomic_counter_type::value_type
 The type of the object upon which the events will be recorded. More...
 

Public Member Functions

constexpr ave_deviation_meter () noexcept(true) FORCE_INLINE
 
constexpr ave_deviation_meter (const value_type val) noexcept(true) FORCE_INLINE
 
constexpr ave_deviation_meter (value_type const val, double const dev) noexcept(true) FORCE_INLINE
 
 ave_deviation_meter (ave_deviation_meter const &rm) noexcept(true) FORCE_INLINE
 
 ~ave_deviation_meter () noexcept(true) FORCE_INLINE
 
ave_deviation_meter &__fastcall operator= (ave_deviation_meter const &rm) noexcept(true)
 
ave_deviation_meter &__fastcall operator+= (ave_deviation_meter const &rm) noexcept(true)
 
ave_deviation_meter &__fastcall update (value_type const new_val) noexcept(true)
 Record a new event that occurred. More...
 
constexpr value_type __fastcall FORCE_INLINE min () const noexcept(true)
 Return the minimum of the samples taken. More...
 
constexpr value_type __fastcall FORCE_INLINE arithmetic_mean () const noexcept(true)
 Return the arithmetic mean of the samples taken. More...
 
constexpr value_type __fastcall FORCE_INLINE max () const noexcept(true)
 Return the maximum of the samples taken. More...
 
constexpr value_type __fastcall FORCE_INLINE total () const noexcept(true)
 Return the total of all of the samples taken. More...
 
constexpr double __fastcall FORCE_INLINE deviation () const noexcept(true)
 Return the average deviation of the samples taken. More...
 
constexpr double __fastcall FORCE_INLINE deviation_percentage () const noexcept(true)
 Return the average deviation, as a percent of the mean, of the samples taken. More...
 
constexpr unsigned short FORCE_INLINE percent () const noexcept(true)
 Return the average deviation as a percentage of the arithmetic mean. More...
 
tstring __fastcall to_string () const noexcept(false)
 
tstring __fastcall to_csv () const noexcept(false)
 

Detailed Description

template<typename MeteredObjType>
class jmmcg::ave_deviation_meter< MeteredObjType >

A class used to compute the arithmetic mean and mean-average deviation [1] of a series of events.

Note that if this class is used in a multi-threaded manner, it is not thread-safe, so these invariants are not guaranteed.

[1] \see invariant()

Definition at line 58 of file ave_deviation_meter.hpp.

Member Typedef Documentation

◆ atomic_counter_type

template<typename MeteredObjType>
using jmmcg::ave_deviation_meter< MeteredObjType >::atomic_counter_type = ppd::atomic_ctr<MeteredObjType, ppd::api_lock_traits<ppd::platform_api, ppd::sequential_mode> >

This is an overly-complicated way of saying "although this might look atomic - I want a sequential version" so it is just the MeteredObjType. std::atomic with program-consistency is not used, because it introduces a lock prefix, which would slow the program being measured. Speed has been traded off for reliable numbers...

Definition at line 80 of file ave_deviation_meter.hpp.

◆ value_type

template<typename MeteredObjType>
using jmmcg::ave_deviation_meter< MeteredObjType >::value_type = typename atomic_counter_type::value_type

The type of the object upon which the events will be recorded.

Definition at line 82 of file ave_deviation_meter.hpp.

Constructor & Destructor Documentation

◆ ave_deviation_meter() [1/4]

template<typename MeteredObjType >
constexpr jmmcg::ave_deviation_meter< MeteredObjType >::ave_deviation_meter ( )
inlineconstexprnoexcept

Definition at line 84 of file ave_deviation_meter_impl.hpp.

◆ ave_deviation_meter() [2/4]

template<typename MeteredObjType >
constexpr jmmcg::ave_deviation_meter< MeteredObjType >::ave_deviation_meter ( const value_type  val)
inlineexplicitconstexprnoexcept

Definition at line 94 of file ave_deviation_meter_impl.hpp.

◆ ave_deviation_meter() [3/4]

template<typename MeteredObjType >
constexpr jmmcg::ave_deviation_meter< MeteredObjType >::ave_deviation_meter ( value_type const  val,
double const  dev 
)
inlineconstexprnoexcept

Definition at line 103 of file ave_deviation_meter_impl.hpp.

◆ ave_deviation_meter() [4/4]

template<typename MeteredObjType >
jmmcg::ave_deviation_meter< MeteredObjType >::ave_deviation_meter ( ave_deviation_meter< MeteredObjType > const &  rm)
inlinenoexcept

Definition at line 112 of file ave_deviation_meter_impl.hpp.

◆ ~ave_deviation_meter()

template<typename MeteredObjType >
jmmcg::ave_deviation_meter< MeteredObjType >::~ave_deviation_meter ( )
inlinenoexcept

Definition at line 122 of file ave_deviation_meter_impl.hpp.

Member Function Documentation

◆ arithmetic_mean()

template<typename MeteredObjType >
constexpr ave_deviation_meter< MeteredObjType >::value_type jmmcg::ave_deviation_meter< MeteredObjType >::arithmetic_mean ( ) const
inlineconstexprnoexcept

Return the arithmetic mean of the samples taken.

Definition at line 175 of file ave_deviation_meter_impl.hpp.

◆ deviation()

template<typename MeteredObjType >
constexpr double jmmcg::ave_deviation_meter< MeteredObjType >::deviation ( ) const
inlineconstexprnoexcept

Return the average deviation of the samples taken.

Note that when using this value you should round to one significant figure.

Returns
The average deviation.

Definition at line 190 of file ave_deviation_meter_impl.hpp.

◆ deviation_percentage()

template<typename MeteredObjType >
constexpr double jmmcg::ave_deviation_meter< MeteredObjType >::deviation_percentage ( ) const
inlineconstexprnoexcept

Return the average deviation, as a percent of the mean, of the samples taken.

Note that when using this value you should round to one significant figure.

Returns
The average deviation as a percentage.

Definition at line 195 of file ave_deviation_meter_impl.hpp.

◆ max()

template<typename MeteredObjType >
constexpr ave_deviation_meter< MeteredObjType >::value_type jmmcg::ave_deviation_meter< MeteredObjType >::max ( ) const
inlineconstexprnoexcept

Return the maximum of the samples taken.

Definition at line 180 of file ave_deviation_meter_impl.hpp.

◆ min()

template<typename MeteredObjType >
constexpr ave_deviation_meter< MeteredObjType >::value_type jmmcg::ave_deviation_meter< MeteredObjType >::min ( ) const
inlineconstexprnoexcept

Return the minimum of the samples taken.

Definition at line 170 of file ave_deviation_meter_impl.hpp.

◆ operator+=()

template<typename MeteredObjType >
ave_deviation_meter< MeteredObjType > & jmmcg::ave_deviation_meter< MeteredObjType >::operator+= ( ave_deviation_meter< MeteredObjType > const &  rm)
inlinenoexcept

Definition at line 138 of file ave_deviation_meter_impl.hpp.

◆ operator=()

template<typename MeteredObjType >
ave_deviation_meter< MeteredObjType > & jmmcg::ave_deviation_meter< MeteredObjType >::operator= ( ave_deviation_meter< MeteredObjType > const &  rm)
inlinenoexcept

Definition at line 126 of file ave_deviation_meter_impl.hpp.

◆ percent()

template<typename MeteredObjType >
constexpr unsigned short jmmcg::ave_deviation_meter< MeteredObjType >::percent ( ) const
inlineconstexprnoexcept

Return the average deviation as a percentage of the arithmetic mean.

Definition at line 200 of file ave_deviation_meter_impl.hpp.

◆ to_csv()

template<typename MeteredObjType >
tstring jmmcg::ave_deviation_meter< MeteredObjType >::to_csv ( ) const
inlinenoexcept

Definition at line 216 of file ave_deviation_meter_impl.hpp.

◆ to_string()

template<typename MeteredObjType >
tstring jmmcg::ave_deviation_meter< MeteredObjType >::to_string ( ) const
inlinenoexcept

Definition at line 205 of file ave_deviation_meter_impl.hpp.

◆ total()

template<typename MeteredObjType >
constexpr ave_deviation_meter< MeteredObjType >::value_type jmmcg::ave_deviation_meter< MeteredObjType >::total ( ) const
inlineconstexprnoexcept

Return the total of all of the samples taken.

Definition at line 185 of file ave_deviation_meter_impl.hpp.

◆ update()

template<typename MeteredObjType >
ave_deviation_meter< MeteredObjType > & jmmcg::ave_deviation_meter< MeteredObjType >::update ( value_type const  new_val)
inlinenoexcept

Record a new event that occurred.

This will update the minimum, maximum, running arithmetic mean and average-deviation measurements.

Definition at line 154 of file ave_deviation_meter_impl.hpp.


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