utils

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2023 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CPUProfilingFunc

func CPUProfilingFunc(fn func(), output string) error

func DeflateGzip

func DeflateGzip(b []byte) ([]byte, error)

func ReadDirRecursively

func ReadDirRecursively(path string) ([]string, error)

Types

type Bucket

type Bucket struct {
	// Count is the number of values represented in the bucket.
	Count int
	// Min is the low, inclusive bound of the bucket.
	Min float64
	// Max is the high, exclusive bound of the bucket. If
	// this bucket is the last bucket, the bound is inclusive
	// and contains the max value of the histogram.
	Max float64
}

Bucket counts a partition of values.

type Histogram

type Histogram struct {
	// Buckets over which values are partitioned.
	Buckets []Bucket
	// Min is the size of the smallest bucket.
	Min int
	// Max is the size of the biggest bucket.
	Max int
	// Count is the total size of all buckets.
	Count int
}

Histogram holds a count of values partitioned over buckets.

func Hist

func Hist(bins int, input []float64) (Histogram, error)

Hist creates a histogram partitioning input over `bins` buckets.

func PowerHist

func PowerHist(power float64, input []float64) Histogram

PowerHist creates a histogram partitioning input over buckets of power `pow`.

func (Histogram) Scale

func (h Histogram) Scale(s ScaleFunc, idx int) float64

Scale gives the scaled count of the bucket at idx, using the provided scale func.

type ScaleFunc

type ScaleFunc func(min, max, value int) float64

ScaleFunc is the type to implement to scale a histogram.

func Linear

func Linear(width int) ScaleFunc

Linear builds a ScaleFunc that will linearly scale the values of a histogram so that they do not exceed width.

Jump to

Keyboard shortcuts

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