faststats

package
v3.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2019 License: Apache-2.0 Imports: 2 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AtomicBoolean

type AtomicBoolean = faststats.AtomicBoolean

AtomicBoolean is a helper struct to simulate atomic operations on a boolean

type AtomicInt64

type AtomicInt64 = faststats.AtomicInt64

AtomicInt64 is a helper struct to simulate atomic operations on an int64 Note that I could have used `type AtomicInt642 int64`, but I did not want to make it easy to do + and - operations so easily without using atomic functions.

type RollingBuckets

type RollingBuckets = faststats.RollingBuckets

RollingBuckets simulates a time rolling list of buckets of items. It is safe to use JSON to encode this object in a thread safe way.

This implementation cheats in order to not take a lock. It is correct, but only if the total size of the buckets (NumBuckets * BucketWidth) is less than any duration of how long Advance will take to execute. In anything but super small bucket sizes this should be fine. The common case, where (NumBuckets * BucketWidth >= 1sec) should always work.

type RollingCounter

type RollingCounter = faststats.RollingCounter

RollingCounter uses a slice of buckets to keep track of counts of an event over time with a sliding window

func NewRollingCounter

func NewRollingCounter(bucketWidth time.Duration, numBuckets int, now time.Time) RollingCounter

NewRollingCounter initializes a rolling counter with a bucket width and # of buckets

type RollingPercentile

type RollingPercentile = faststats.RollingPercentile

RollingPercentile is a bucketed array of time.Duration that cycles over time

func NewRollingPercentile

func NewRollingPercentile(bucketWidth time.Duration, numBuckets int, bucketSize int, now time.Time) RollingPercentile

NewRollingPercentile creates a new rolling percentile bucketer

type SortedDurations

type SortedDurations = faststats.SortedDurations

SortedDurations is a sorted list of time.Duration that allows fast Percentile operations

type TimedCheck

type TimedCheck = faststats.TimedCheck

TimedCheck lets X events happen every sleepDuration units of time. For optimizations, it uses TimeAfterFunc to reset an internal atomic boolean for when events are allowed. This timer could run a little bit behind real time since it depends on when the OS decides to trigger the timer.

Jump to

Keyboard shortcuts

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