hdrhist

package
v1.16.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 18, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodeCompressed

func EncodeCompressed(h *Hist) ([]byte, error)

Types

type Config

type Config struct {

	// LowestDiscernible is the lowest value that
	// can be discerned from 0. Must be positive.
	// This number may be rounded down to the
	// nearest power of 2.
	LowestDiscernible int64

	// HighestTrackable is the largest value that can
	// be tracked by the histogram. This must be at
	// least twice the value of LowestDiscernible.
	HighestTrackable int64

	// SigFigs are the number of significant figures
	// that will be maintained by the histogram. Must
	// be ∈ [0,5].
	SigFigs int32

	// AutoResize will adjust HighestTrackable and
	// resize the histogram if necessary. Note that
	// resizing the histogram requires allocation
	// and will take longer than a typical operation.
	AutoResize bool
	// contains filtered or unexported fields
}

Config contains the options that can be used to configure a Hist.

type Hist

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

func DecodeCompressed

func DecodeCompressed(buf []byte) (*Hist, error)

func New

func New(sigfigs int32) *Hist

New creates a new Hist that auto-resizes and has a LowestDiscernible value of 1. Valid values for sigfigs are between 0 and 5.

func WithConfig

func WithConfig(cfg Config) *Hist

WithConfig creates a new Hist with the provided Config.

func (*Hist) Add

func (h *Hist) Add(o *Hist)

func (*Hist) AllVals

func (h *Hist) AllVals() []HistVal

func (*Hist) Clear

func (h *Hist) Clear()

Clear deletes all recorded values as well as the start and end times.

func (*Hist) Clone

func (h *Hist) Clone() *Hist

Clone returns a deep copy of the histogram. This is useful when combining or taking differences of histograms.

func (*Hist) Config

func (h *Hist) Config() Config

func (*Hist) EndTime

func (h *Hist) EndTime() (time.Time, bool)

func (*Hist) EstMemSize

func (h *Hist) EstMemSize() int

EstMemSize estimates the number of bytes being consumed by the histogram. It ignores any memory usage caused by the start time and end time. The resulting size should not be assumed to be exact. The return value is in bytes.

func (*Hist) GetConfig

func (h *Hist) GetConfig() Config

func (*Hist) Init

func (h *Hist) Init(cfg Config)

Init initializes the Hist with the given Config.

func (*Hist) Max

func (h *Hist) Max() int64

func (*Hist) Mean

func (h *Hist) Mean() float64

func (*Hist) Min

func (h *Hist) Min() int64

func (*Hist) PercentileVal

func (h *Hist) PercentileVal(p float64) HistVal

func (*Hist) Record

func (h *Hist) Record(v int64)

func (*Hist) RecordCorrected

func (h *Hist) RecordCorrected(v int64, expectedInterval int64)

func (*Hist) RecordN

func (h *Hist) RecordN(v, count int64)

func (*Hist) SetAutoResize

func (h *Hist) SetAutoResize(b bool)

func (*Hist) SetEndTime

func (h *Hist) SetEndTime(t time.Time)

func (*Hist) SetStartTime

func (h *Hist) SetStartTime(t time.Time)

func (*Hist) StartTime

func (h *Hist) StartTime() (time.Time, bool)

func (*Hist) Stdev

func (h *Hist) Stdev() float64

func (*Hist) Sub

func (h *Hist) Sub(o *Hist)

func (*Hist) TotalCount

func (h *Hist) TotalCount() int64

func (*Hist) Val

func (h *Hist) Val(v int64) HistVal

type HistVal

type HistVal struct {
	Value      int64
	Count      int64
	CumCount   int64
	Percentile float64
}

type LogWriter

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

func NewLogWriter

func NewLogWriter(w io.Writer) *LogWriter

func (*LogWriter) GetBaseTime

func (l *LogWriter) GetBaseTime() (time.Time, bool)

func (*LogWriter) SetBaseTime

func (l *LogWriter) SetBaseTime(base time.Time)

func (*LogWriter) WriteBaseTime

func (l *LogWriter) WriteBaseTime(base time.Time) error

func (*LogWriter) WriteComment

func (l *LogWriter) WriteComment(text string) error

func (*LogWriter) WriteIntervalHist

func (l *LogWriter) WriteIntervalHist(h *Hist) error

func (*LogWriter) WriteLegend

func (l *LogWriter) WriteLegend() error

func (*LogWriter) WriteStartTime

func (l *LogWriter) WriteStartTime(start time.Time) error

type Recorder

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

func NewRecorder

func NewRecorder(sigfigs int32) *Recorder

func NewRecorderWithConfig

func NewRecorderWithConfig(cfg Config) *Recorder

func (*Recorder) Clear

func (r *Recorder) Clear()

func (*Recorder) Init

func (r *Recorder) Init(cfg Config)

func (*Recorder) IntervalHist

func (r *Recorder) IntervalHist(h *Hist) *Hist

func (*Recorder) Record

func (r *Recorder) Record(v int64)

func (*Recorder) RecordCorrected

func (r *Recorder) RecordCorrected(v int64, expectedInterval int64)

func (*Recorder) RecordN

func (r *Recorder) RecordN(v, count int64)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL