Documentation
¶
Overview ¶
Package ghistogram provides a simple histogram of ints that avoids heap allocations (garbage creation) during data processing.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Histogram ¶
type Histogram struct { Ranges []int // Lower bound of bin, so Ranges[0] == binStart. Counts []uint64 }
Histogram is a simple int histogram implementation that avoids heap allocations (garbage creation) during its processing of incoming data points.
The histogram bins are split across arrays of Ranges and Counts, where len(Ranges) == len(Counts). These arrays are public in case users wish to use reflection or JSON marhsallings.
Concurrent access (e.g., locking) on a Histogram is a responsibility of the user's application.
func NewHistogram ¶
NewHistogram creates a new, ready to use Histogram. The numBins must be >= 2. The binFirst is the width of the first bin. The binGrowthFactor must be > 1.0.