11 template <
typename book_depth_histogram_t>
12 void csv_rate(std::ostream& os, book_depth_histogram_t
const& histo) {
13 os << histo.observed_min() <<
"," << histo.estimated_quantile(0.25) <<
"," 14 << histo.estimated_quantile(0.50) <<
"," << histo.estimated_quantile(0.75)
15 <<
"," << histo.estimated_quantile(0.90) <<
"," 16 << histo.estimated_quantile(0.99) <<
"," << histo.estimated_quantile(0.999)
17 <<
"," << histo.estimated_quantile(0.9999) <<
"," << histo.observed_max();
20 template <
typename book_depth_histogram_t>
22 std::chrono::nanoseconds ts, book_depth_histogram_t
const& histo) {
24 <<
", NSamples =" << histo.nsamples()
25 <<
", min=" << histo.observed_min()
26 <<
", p25=" << histo.estimated_quantile(0.25)
27 <<
", p50=" << histo.estimated_quantile(0.50)
28 <<
", p75=" << histo.estimated_quantile(0.75)
29 <<
", p90=" << histo.estimated_quantile(0.90)
30 <<
", p99=" << histo.estimated_quantile(0.99)
31 <<
", p99.9=" << histo.estimated_quantile(0.999)
32 <<
", p99.99=" << histo.estimated_quantile(0.9999)
33 <<
", max=" << histo.observed_max();
45 <<
",minBookDepth,p25BookDepth,p50BookDepth,p75BookDepth" 46 <<
",p90BookDepth,p99BookDepth,p999BookDepth,p9999BookDepth" 52 std::string
const& name, std::ostream& os)
const {
67 #ifndef JB_BOOK_DEPTH_STATS_DEFAULTS_max_book_depth 68 #define JB_BOOK_DEPTH_STATS_DEFAULTS_max_book_depth 8192 78 desc(
"max-book-depth")
80 "Configure the book_depth histogram to expect" 81 " no more than this many values" 82 " Higher values consume more memory, but give more accurate" 83 " results for high percentiles."),
89 std::ostringstream os;
book_depth_t max_book_depth
Define defaults for program parameters.
static void print_csv_header(std::ostream &os)
Print a CSV header.
#define JB_BOOK_DEPTH_STATS_DEFAULTS_max_book_depth
Helper class to print time durations s in HHMMSS format.
void print_csv(std::string const &name, std::ostream &os) const
Print all the measurements in CSV format.
book_depth_histogram_t book_depth_
jb::config_attribute< config, book_depth_t > max_book_depth
No more than this value is recorded.
Configure a book_depth_statistics object.
A simple class to communicate the result of parsing the options.
unsigned long int book_depth_t
std::uint64_t nsamples() const
Return the number of samples observed to this point.
void validate() const override
Validate the configuration.
book_depth_statistics(config const &cfg)
Constructor.
The top-level namespace for the JayBeams library.