Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Histogram ¶
type Histogram struct { // Count is the total number of values added to the histogram. Count int64 // Sum is the sum of all the values added to the histogram. Sum int64 // SumOfSquares is the sum of squares of all values. SumOfSquares int64 // Min is the minimum of all the values added to the histogram. Min int64 // Max is the maximum of all the values added to the histogram. Max int64 // Buckets contains all the buckets of the histogram. Buckets []HistogramBucket // contains filtered or unexported fields }
Histogram accumulates values in the form of a histogram with exponentially increased bucket sizes.
func NewHistogram ¶
func NewHistogram(opts HistogramOptions) *Histogram
NewHistogram returns a pointer to a new Histogram object that was created with the provided options.
func (*Histogram) Merge ¶
Merge takes another histogram h2, and merges its content into h. The two histograms must be created by equivalent HistogramOptions.
func (*Histogram) Opts ¶
func (h *Histogram) Opts() HistogramOptions
Opts returns a copy of the options used to create the Histogram.
type HistogramBucket ¶
type HistogramBucket struct { // LowBound is the lower bound of the bucket. LowBound float64 // Count is the number of values in the bucket. Count int64 }
HistogramBucket represents one histogram bucket.
type HistogramOptions ¶
type HistogramOptions struct { // NumBuckets is the number of buckets. NumBuckets int // GrowthFactor is the growth factor of the buckets. A value of 0.1 // indicates that bucket N+1 will be 10% larger than bucket N. GrowthFactor float64 // BaseBucketSize is the size of the first bucket. BaseBucketSize float64 // MinValue is the lower bound of the first bucket. MinValue int64 }
HistogramOptions contains the parameters that define the histogram's buckets. The first bucket of the created histogram (with index 0) contains [min, min+n) where n = BaseBucketSize, min = MinValue. Bucket i (i>=1) contains [min + n * m^(i-1), min + n * m^i), where m = 1+GrowthFactor. The type of the values is int64.