Seastar
High performance C++ framework for concurrent servers
|
estimated histogram for duration values time_estimated_histogram is used for short task timing. It covers the range of 0.5ms to 33s with a precision of 4.
512us, 640us, 768us, 896us, 1024us, 1280us, 1536us, 1792us...16s, 20s, 25s, 29s, 33s (33554432us)
#include <seastar/core/internal/estimated_histogram.hh>
Public Member Functions | |
time_estimated_histogram & | merge (const time_estimated_histogram &b) |
void | add_micro (uint64_t n) |
template<typename T > | |
void | add (const T &latency) |
uint64_t | get_bucket_lower_limit (uint16_t bucket_id) const |
Returns the bucket lower limit given the bucket id. The first and last bucket will always return the MIN and MAX respectively. | |
uint64_t | get_bucket_upper_limit (uint16_t bucket_id) const |
Returns the bucket upper limit given the bucket id. The last bucket (Infinity bucket) will return UMAX_INT. | |
uint16_t | find_bucket_index (uint64_t val) const |
Find the bucket index for a given value The position of a value that is lower or equal to Min will always be 0. The position of a value that is higher or equal to MAX will always be NUM_BUCKETS - 1. | |
void | clear () |
clear the current values. | |
void | add (uint64_t n) |
Add an item to the histogram Increments the count of the bucket holding that value. | |
uint64_t | min () const |
returns the smallest value that could have been added to this histogram This method looks for the first non-empty bucket and returns its lower limit. Note that for non-empty histogram the lowest potentail value is Min. More... | |
uint64_t | max () const |
returns the largest value that could have been added to this histogram. This method looks for the first non empty bucket and return its upper limit. If the histogram overflowed, it will returns UINT64_MAX. More... | |
approximate_exponential_histogram & | merge (const approximate_exponential_histogram &b) |
merge a histogram to the current one. | |
uint64_t | get (size_t bucket) const |
uint64_t | quantile (float quantile) const |
get a histogram quantile More... | |
uint64_t | mean () const |
returns the mean histogram value (average of bucket offsets, weighted by count) It will return 0 if the histogram is empty. | |
size_t | size () const |
returns the number of buckets; | |
uint64_t | count () const |
returns the total number of values inserted | |
approximate_exponential_histogram & | operator*= (double v) |
multiple all the buckets content in the histogram by a constant | |
uint64_t & | operator[] (size_t b) noexcept |
int32_t | get_schema () const noexcept |
get_schema the schema of a native histogram More... | |
int32_t | min_as_native_histogram_id () const noexcept |
return the histogram min as a native histogram ID More... | |
seastar::metrics::histogram | to_metrics_histogram () const noexcept |
|
inlinenoexceptinherited |
get_schema the schema of a native histogram
Native histograms (also known as sparse histograms), are an experimental Prometheus feature.
schema defines the bucket schema. Currently, valid numbers are -4 <= n <= 8. They are all for base-2 bucket schemas, where 1 is a bucket boundary in each case, and then each power of two is divided into 2^n logarithmic buckets. Or in other words, each bucket boundary is the previous boundary times 2^(2^-n).
|
inlineinherited |
returns the largest value that could have been added to this histogram. This method looks for the first non empty bucket and return its upper limit. If the histogram overflowed, it will returns UINT64_MAX.
It will return 0 if the histogram is empty.
|
inlineinherited |
returns the smallest value that could have been added to this histogram This method looks for the first non-empty bucket and returns its lower limit. Note that for non-empty histogram the lowest potentail value is Min.
It will return 0 if the histogram is empty.
|
inlinenoexceptinherited |
return the histogram min as a native histogram ID
Native histograms (also known as sparse histograms), are an experimental Prometheus feature.
Native histograms always starts from 1, while approximate_exponential_histogram have a min first bucket This function returns approximate_exponential_histogram min value as the bucket id of native histogram.
|
inlineinherited |
get a histogram quantile
This method will returns the estimated value at a given quantile. If there are N values in the histogram. It would look for the bucket that the total number of elements in the buckets before it are less than N * quantile and return that bucket lower limit.
For example, quantile(0.5) will find the bucket that that sum of all buckets values below it is less than half and will return that bucket lower limit. In this example, this is a median estimation.
It will return 0 if the histogram is empty.