v.io: v.io/x/ref/lib/stats/histogram Index | Files

package histogram

import "v.io/x/ref/lib/stats/histogram"

Package histogram implements a basic histogram to keep track of data distribution.

Index

Package Files

histogram.go

type Histogram Uses

type Histogram struct {
    // contains filtered or unexported fields
}

A Histogram accumulates values in the form of a histogram. The type of the values is int64, which is suitable for keeping track of things like RPC latency in milliseconds. New histogram objects should be obtained via the New() function.

func New Uses

func New(opts Options) *Histogram

New returns a pointer to a new Histogram object that was created with the provided options.

func (*Histogram) Add Uses

func (h *Histogram) Add(value int64) error

Add adds a value to the histogram.

func (*Histogram) Delta10m Uses

func (h *Histogram) Delta10m() stats.HistogramValue

Delta10m returns the change in the last 10 minutes.

func (*Histogram) Delta1h Uses

func (h *Histogram) Delta1h() stats.HistogramValue

Delta1h returns the change in the last hour.

func (*Histogram) Delta1m Uses

func (h *Histogram) Delta1m() stats.HistogramValue

Delta1m returns the change in the last 10 minutes.

func (*Histogram) LastUpdate Uses

func (h *Histogram) LastUpdate() time.Time

LastUpdate returns the time at which the object was last updated.

func (*Histogram) Opts Uses

func (h *Histogram) Opts() Options

Opts returns a copy of the options used to create the Histogram.

func (*Histogram) Value Uses

func (h *Histogram) Value() stats.HistogramValue

Value returns the accumulated state of the histogram since it was created.

type Options Uses

type Options 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
    // SmallestBucketSize is the size of the first bucket. Bucket sizes are
    // rounded down to the nearest integer.
    SmallestBucketSize float64
    // MinValue is the lower bound of the first bucket.
    MinValue int64
}

Options contains the parameters that define the histogram's buckets.

Package histogram imports 4 packages (graph) and is imported by 17 packages. Updated 2020-10-22. Refresh now. Tools for package owners.