JayBeams  0.1
Another project to have fun coding.
Classes | Public Member Functions | Static Public Member Functions | Private Types | Private Attributes | List of all members
jb::book_depth_statistics Class Reference

Keep statistics about a feed and its book depth. More...

#include <book_depth_statistics.hpp>

Classes

class  config
 Configure a book_depth_statistics object. More...
 

Public Member Functions

 book_depth_statistics (config const &cfg)
 Constructor. More...
 
template<typename book_depth_t >
void sample (book_depth_t book_depth)
 Record a sample, that is book depth value after the event. More...
 
void print_csv (std::string const &name, std::ostream &os) const
 Print all the measurements in CSV format. More...
 

Static Public Member Functions

static void print_csv_header (std::ostream &os)
 Print a CSV header. More...
 

Private Types

typedef histogram< integer_range_binning< book_depth_t > > book_depth_histogram_t
 

Private Attributes

book_depth_histogram_t book_depth_
 

Detailed Description

Keep statistics about a feed and its book depth.

Definition at line 17 of file book_depth_statistics.hpp.

Member Typedef Documentation

◆ book_depth_histogram_t

Definition at line 63 of file book_depth_statistics.hpp.

Constructor & Destructor Documentation

◆ book_depth_statistics()

jb::book_depth_statistics::book_depth_statistics ( config const &  cfg)
explicit

Constructor.

Definition at line 38 of file book_depth_statistics.cpp.

Member Function Documentation

◆ print_csv()

void jb::book_depth_statistics::print_csv ( std::string const &  name,
std::ostream &  os 
) const

Print all the measurements in CSV format.

Definition at line 51 of file book_depth_statistics.cpp.

References book_depth_, and jb::histogram< binning_strategy_t, counter_type_t >::nsamples().

Referenced by BOOST_AUTO_TEST_CASE(), main(), and sample().

◆ print_csv_header()

void jb::book_depth_statistics::print_csv_header ( std::ostream &  os)
static

Print a CSV header.

The fields include:

  • name: the name of the book_depth_statistics<> object.
  • nsamples: the number of samples received.
  • minBookDepth: the minimum book depth observed
  • p25BookDepth: the 25th percentile for book depth observed
  • p50BookDepth: the 50th percentile for book depth observed
  • p75BookDepth: the 75th percentile for book depth observed
  • p90BookDepth: the 90th percentile for book depth observed
  • p99BookDepth: the 99th percentile for book depth observed
  • p999BookDepth: the 99.9th percentile for book depth observed
  • p9999BookDepth: the 99.99th percentile for book depth observed
  • maxBookDepth: the maximum for book depth observed
Parameters
osthe output stream

Definition at line 43 of file book_depth_statistics.cpp.

Referenced by BOOST_AUTO_TEST_CASE(), main(), and sample().

◆ sample()

template<typename book_depth_t >
void jb::book_depth_statistics::sample ( book_depth_t  book_depth)
inline

Record a sample, that is book depth value after the event.

Template Parameters
book_depth_tthe type used to record the book depth after processing the event.
Parameters
book_depth: the book depth (after processing the event) to be recorded.

Definition at line 33 of file book_depth_statistics.hpp.

References book_depth_, print_csv(), print_csv_header(), and jb::histogram< binning_strategy_t, counter_type_t >::sample().

Referenced by BOOST_AUTO_TEST_CASE().

Member Data Documentation

◆ book_depth_

book_depth_histogram_t jb::book_depth_statistics::book_depth_
private

Definition at line 64 of file book_depth_statistics.hpp.

Referenced by print_csv(), and sample().


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