Toolbox snapshot
The Reactive C++ Toolbox
Loading...
Searching...
No Matches
Public Member Functions | List of all members
toolbox::hdr::Histogram Class Reference

A High Dynamic Range (HDR) Histogram. More...

#include <toolbox/hdr/Histogram.hpp>

Public Member Functions

 Histogram (const BucketConfig &config)
 
 Histogram (std::int64_t lowest_trackable_value, std::int64_t highest_trackable_value, std::int32_t significant_figures)
 
 ~Histogram () noexcept=default
 
 Histogram (const Histogram &)=default
 
Histogramoperator= (const Histogram &)=default
 
 Histogram (Histogram &&) noexcept=default
 
Histogramoperator= (Histogram &&) noexcept=default
 
std::int64_t lowest_trackable_value () const noexcept
 
std::int64_t highest_trackable_value () const noexcept
 
std::int32_t significant_figures () const noexcept
 
std::int32_t sub_bucket_count () const noexcept
 
std::int32_t bucket_count () const noexcept
 
std::int64_t total_count () const noexcept
 
std::int32_t counts_len () const noexcept
 
std::int64_t min () const noexcept
 Get minimum value from the histogram. Will return 2^63-1 if the histogram is empty.
 
std::int64_t max () const noexcept
 Get maximum value from the histogram. Will return 0 if the histogram is empty.
 
bool values_are_equivalent (std::int64_t a, std::int64_t b) const noexcept
 
std::int64_t lowest_equivalent_value (std::int64_t value) const noexcept
 
std::int64_t highest_equivalent_value (std::int64_t value) const noexcept
 
std::int64_t count_at_value (std::int64_t value) const noexcept
 
std::int64_t count_at_index (std::int32_t index) const noexcept
 
std::int64_t value_at_index (std::int32_t index) const noexcept
 
std::int64_t size_of_equivalent_value_range (std::int64_t value) const noexcept
 
std::int64_t next_non_equivalent_value (std::int64_t value) const noexcept
 
std::int64_t median_equivalent_value (std::int64_t value) const noexcept
 
std::int64_t counts_get_normalised (std::int32_t index) const noexcept
 
void reset () noexcept
 
bool record_value (std::int64_t value) noexcept
 
bool record_values (std::int64_t value, std::int64_t count) noexcept
 

Detailed Description

A High Dynamic Range (HDR) Histogram.

Definition at line 64 of file Histogram.hpp.

Constructor & Destructor Documentation

◆ Histogram() [1/4]

toolbox::hdr::Histogram::Histogram ( const BucketConfig config)
explicit

Definition at line 96 of file Histogram.cpp.

◆ Histogram() [2/4]

toolbox::hdr::Histogram::Histogram ( std::int64_t  lowest_trackable_value,
std::int64_t  highest_trackable_value,
std::int32_t  significant_figures 
)

◆ ~Histogram()

toolbox::hdr::Histogram::~Histogram ( )
defaultnoexcept

◆ Histogram() [3/4]

toolbox::hdr::Histogram::Histogram ( const Histogram )
default

◆ Histogram() [4/4]

toolbox::hdr::Histogram::Histogram ( Histogram &&  )
defaultnoexcept

Member Function Documentation

◆ operator=() [1/2]

Histogram & toolbox::hdr::Histogram::operator= ( const Histogram )
default

◆ operator=() [2/2]

Histogram & toolbox::hdr::Histogram::operator= ( Histogram &&  )
defaultnoexcept

◆ lowest_trackable_value()

std::int64_t toolbox::hdr::Histogram::lowest_trackable_value ( ) const
inlinenoexcept

Definition at line 79 of file Histogram.hpp.

◆ highest_trackable_value()

std::int64_t toolbox::hdr::Histogram::highest_trackable_value ( ) const
inlinenoexcept

Definition at line 80 of file Histogram.hpp.

◆ significant_figures()

std::int32_t toolbox::hdr::Histogram::significant_figures ( ) const
inlinenoexcept

Definition at line 81 of file Histogram.hpp.

◆ sub_bucket_count()

std::int32_t toolbox::hdr::Histogram::sub_bucket_count ( ) const
inlinenoexcept

Definition at line 83 of file Histogram.hpp.

◆ bucket_count()

std::int32_t toolbox::hdr::Histogram::bucket_count ( ) const
inlinenoexcept

Definition at line 84 of file Histogram.hpp.

◆ total_count()

std::int64_t toolbox::hdr::Histogram::total_count ( ) const
inlinenoexcept

◆ counts_len()

std::int32_t toolbox::hdr::Histogram::counts_len ( ) const
inlinenoexcept

◆ min()

int64_t toolbox::hdr::Histogram::min ( ) const
noexcept

Get minimum value from the histogram. Will return 2^63-1 if the histogram is empty.

Definition at line 120 of file Histogram.cpp.

Referenced by toolbox::bm::BenchmarkSuite::report().

◆ max()

int64_t toolbox::hdr::Histogram::max ( ) const
noexcept

Get maximum value from the histogram. Will return 0 if the histogram is empty.

Definition at line 128 of file Histogram.cpp.

◆ values_are_equivalent()

bool toolbox::hdr::Histogram::values_are_equivalent ( std::int64_t  a,
std::int64_t  b 
) const
noexcept

Determine if two values are equivalent with the histogram's resolution. Where "equivalent" means that value samples recorded for any two equivalent values are counted in a common total count.

Parameters
afirst value to compare.
bsecond value to compare.
Returns
true if values are equivalent with the histogram's resolution.

Definition at line 136 of file Histogram.cpp.

◆ lowest_equivalent_value()

int64_t toolbox::hdr::Histogram::lowest_equivalent_value ( std::int64_t  value) const
noexcept

Get the lowest value that is equivalent to the given value within the histogram's resolution. Where "equivalent" means that value samples recorded for any two equivalent values are counted in a common total count.

Parameters
valueThe given value.
Returns
the lowest value that is equivalent to the given value within the histogram's resolution.

Definition at line 141 of file Histogram.cpp.

Referenced by toolbox::hdr::LinearIterator::do_next(), toolbox::hdr::LogIterator::do_next(), and toolbox::hdr::Iterator::move_next().

◆ highest_equivalent_value()

int64_t toolbox::hdr::Histogram::highest_equivalent_value ( std::int64_t  value) const
noexcept

◆ count_at_value()

int64_t toolbox::hdr::Histogram::count_at_value ( std::int64_t  value) const
noexcept

Get the count of recorded values at a specific value (to within the histogram resolution at the value level).

Parameters
valueThe value for which to provide the recorded count.
Returns
The total count of values recorded in the histogram within the value range.

Definition at line 153 of file Histogram.cpp.

◆ count_at_index()

int64_t toolbox::hdr::Histogram::count_at_index ( std::int32_t  index) const
noexcept

Definition at line 158 of file Histogram.cpp.

Referenced by min().

◆ value_at_index()

int64_t toolbox::hdr::Histogram::value_at_index ( std::int32_t  index) const
noexcept

◆ size_of_equivalent_value_range()

int64_t toolbox::hdr::Histogram::size_of_equivalent_value_range ( std::int64_t  value) const
noexcept

Definition at line 175 of file Histogram.cpp.

◆ next_non_equivalent_value()

int64_t toolbox::hdr::Histogram::next_non_equivalent_value ( std::int64_t  value) const
noexcept

Definition at line 184 of file Histogram.cpp.

◆ median_equivalent_value()

int64_t toolbox::hdr::Histogram::median_equivalent_value ( std::int64_t  value) const
noexcept

Definition at line 189 of file Histogram.cpp.

Referenced by toolbox::hdr::Iterator::move_next().

◆ counts_get_normalised()

int64_t toolbox::hdr::Histogram::counts_get_normalised ( std::int32_t  index) const
noexcept

Definition at line 194 of file Histogram.cpp.

Referenced by toolbox::hdr::Iterator::move_next().

◆ reset()

void toolbox::hdr::Histogram::reset ( )
noexcept

Reset a histogram to zero - empty out a histogram and re-initialise it.

If you want to re-use an existing histogram, but reset everything back to zero, this is the routine to use.

Definition at line 199 of file Histogram.cpp.

◆ record_value()

bool toolbox::hdr::Histogram::record_value ( std::int64_t  value)
noexcept

Records a value in the histogram, will round this value of to a precision at or better than the significant_figure specified at construction time.

Parameters
valueValue to add to the histogram.
Returns
false if the value is larger than the highest_trackable_value and can't be recorded, true otherwise.

Definition at line 207 of file Histogram.cpp.

Referenced by BOOST_AUTO_TEST_CASE().

◆ record_values()

bool toolbox::hdr::Histogram::record_values ( std::int64_t  value,
std::int64_t  count 
)
noexcept

Records count values in the histogram, will round this value of to a precision at or better than the significant_figure specified at construction time.

Parameters
valueValue to add to the histogram.
countNumber of values to add to the histogram.
Returns
false if any value is larger than the highest_trackable_value and can't be recorded, true otherwise.

Definition at line 212 of file Histogram.cpp.

Referenced by toolbox::bm::BenchmarkRange::~BenchmarkRange(), and toolbox::bm::BenchmarkRecord::~BenchmarkRecord().


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