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 ¶
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.