Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Memset ¶
Memset is a faster way to initialize a float64 array.
- Inspired from https://github.com/tmthrgd/go-memset. Can't use that library here directly since the library works on byte interface. 0 case is optimized due to https://github.com/golang/go/issues/5373 but for non zero case, we use the copy() optimization.
BenchmarkMemsetZeroValues-4 1000000 1344 ns/op 0 B/op 0 allocs/op BenchmarkLoopZeroValues-4 500000 3217 ns/op 0 B/op 0 allocs/op BenchmarkMemsetNonZeroValues-4 1000000 1537 ns/op 0 B/op 0 allocs/op BenchmarkLoopNonZeroValues-4 500000 3236 ns/op 0 B/op 0 allocs/op *
Types ¶
type Datapoints ¶
type Datapoints []Datapoint
Datapoints is a list of datapoints.
func (Datapoints) DatapointAt ¶
func (d Datapoints) DatapointAt(n int) Datapoint
DatapointAt returns the value at the nth element.
func (Datapoints) ValueAt ¶
func (d Datapoints) ValueAt(n int) float64
ValueAt returns the value at the nth element.
type FixedResolutionMutableValues ¶
type FixedResolutionMutableValues interface { MutableValues Resolution() time.Duration StepAtTime(t time.Time) int StartTimeForStep(n int) time.Time // Time when the series starts StartTime() time.Time MillisPerStep() time.Duration }
FixedResolutionMutableValues are mutable values with fixed resolution between steps
func NewFixedStepValues ¶
func NewFixedStepValues(millisPerStep time.Duration, numSteps int, initialValue float64, startTime time.Time) FixedResolutionMutableValues
NewFixedStepValues returns mutable values with fixed resolution
type MutableValues ¶
type MutableValues interface { Values // Sets the value at the given entry SetValueAt(n int, v float64) }
MutableValues is the interface for values that can be updated
type Series ¶
A Series is the public interface to a block of timeseries values. Each block has a start time, a logical number of steps, and a step size indicating the number of milliseconds represented by each point.
func NewSeries ¶
NewSeries creates a new Series at a given start time, backed by the provided values
type Values ¶
type Values interface { // Len returns the number of values present Len() int // ValueAt returns the value at the nth element ValueAt(n int) float64 // DatapointAt returns the datapoint at the nth element DatapointAt(n int) Datapoint }
Values holds the values for a timeseries. It provides a minimal interface for storing and retrieving values in the series, with Series providing a more convenient interface for applications to build on top of. Values objects are not specific to a given time, allowing them to be pre-allocated, pooled, and re-used across multiple Series. There are multiple implementations of Values so that we can optimize storage based on the density of the series.