cockroach: github.com/cockroachdb/cockroach/pkg/workload/histogram Index | Files

package histogram

import "github.com/cockroachdb/cockroach/pkg/workload/histogram"

Index

Package Files

histogram.go

func Copy Uses

func Copy(h *hdrhistogram.Histogram) *hdrhistogram.Histogram

Copy makes a new histogram which is a copy of h.

func DecodeSnapshots Uses

func DecodeSnapshots(path string) (map[string][]SnapshotTick, error)

DecodeSnapshots decodes a file with SnapshotTicks into a series.

type Histograms Uses

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

Histograms is a thread-local handle for creating and registering NamedHistograms.

func (*Histograms) Get Uses

func (w *Histograms) Get(name string) *NamedHistogram

Get returns a NamedHistogram with the given name, creating and registering it if necessary. The result is cached, so no need to cache it in the workload.

type NamedHistogram Uses

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

NamedHistogram is a named histogram for use in Operations. It is threadsafe but intended to be thread-local.

func (*NamedHistogram) Record Uses

func (w *NamedHistogram) Record(elapsed time.Duration)

Record saves a new datapoint and should be called once per logical operation.

type Registry Uses

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

Registry is a thread-safe enclosure for a (possibly large) number of named histograms. It allows for "tick"ing them periodically to reset the counts and also supports aggregations.

func NewRegistry Uses

func NewRegistry(maxLat time.Duration) *Registry

NewRegistry returns an initialized Registry. maxLat is the maximum time that queries are expected to take to execute which is needed to initialize the pool of histograms.

func (*Registry) GetHandle Uses

func (w *Registry) GetHandle() *Histograms

GetHandle returns a thread-local handle for creating and registering NamedHistograms.

func (*Registry) Tick Uses

func (w *Registry) Tick(fn func(Tick))

Tick aggregates all registered histograms, grouped by name. It is expected to be called periodically from one goroutine.

type SnapshotTick Uses

type SnapshotTick struct {
    Name    string
    Hist    *hdrhistogram.Snapshot
    Elapsed time.Duration
    Now     time.Time
}

SnapshotTick parallels Tick but replace the histogram with a snapshot that is suitable for serialization. Additionally, it only contains the per-tick histogram, not the cumulative histogram. (The cumulative histogram can be computed by aggregating all of the per-tick histograms).

type Tick Uses

type Tick struct {
    // Name is the name given to the histograms represented by this tick.
    Name string
    // Hist is the merged result of the represented histograms for this tick.
    // Hist.TotalCount() is the number of operations that occurred for this tick.
    Hist *hdrhistogram.Histogram
    // Cumulative is the merged result of the represented histograms for all
    // time. Cumulative.TotalCount() is the total number of operations that have
    // occurred over all time.
    Cumulative *hdrhistogram.Histogram
    // Elapsed is the amount of time since the last tick.
    Elapsed time.Duration
    // Now is the time at which the tick was gathered. It covers the period
    // [Now-Elapsed,Now).
    Now time.Time
}

Tick is an aggregation of ticking all histograms in a Registry with a given name.

func (Tick) Snapshot Uses

func (t Tick) Snapshot() SnapshotTick

Snapshot creates a SnapshotTick from the receiver.

Package histogram imports 10 packages (graph) and is imported by 43 packages. Updated 2019-08-08. Refresh now. Tools for package owners.