iotex-core: Index | Files

package counter

import ""


Package Files


type SlidingWindowCounter Uses

type SlidingWindowCounter struct {
    Interval        time.Duration
    SlotGranularity time.Duration
    // contains filtered or unexported fields

SlidingWindowCounter is used to count the number of events happened in the last X duration (in terms of a sliding window). Interval defines how big the time window is and SlotGranularity defines how fine grained the counter is.

func NewSlidingWindowCounter Uses

func NewSlidingWindowCounter(i time.Duration, sg time.Duration) *SlidingWindowCounter

NewSlidingWindowCounter creates an instance of SlidingWindowCounter

func NewSlidingWindowCounterWithSecondSlot Uses

func NewSlidingWindowCounterWithSecondSlot(i time.Duration) *SlidingWindowCounter

NewSlidingWindowCounterWithSecondSlot creates an instance of SlidingWindowCounter with the second level slot

func (*SlidingWindowCounter) Count Uses

func (c *SlidingWindowCounter) Count() uint64

Count reads the current gauge. It's a blocking operation.

func (*SlidingWindowCounter) Increment Uses

func (c *SlidingWindowCounter) Increment()

Increment increase the counter by 1. It's a blocking operation.

Package counter imports 2 packages (graph). Updated 2018-09-05. Refresh now. Tools for package owners.