func (r *ewmaRate) tick() {
	newEvents := atomic.LoadInt64(&r.newEvents)
	atomic.AddInt64(&r.newEvents, -newEvents)
	instantRate := float64(newEvents) / r.interval.Seconds()

	r.mutex.Lock()
	defer r.mutex.Unlock()

	if r.init {
		r.lastRate += r.alpha * (instantRate - r.lastRate)
	} else {
		r.init = true
		r.lastRate = instantRate
	}
}
func (r *ewmaRate) tick() {
	newEvents := atomic.LoadInt64(&r.newEvents)
	atomic.AddInt64(&r.newEvents, -newEvents)
	instantRate := float64(newEvents) / r.interval.Seconds()

	r.mutex.Lock()
	defer r.mutex.Unlock()

	if r.init {
		r.lastRate += r.alpha * (instantRate - r.lastRate)
	} else {
		r.init = true
		r.lastRate = instantRate
	}
}
func ( r * ewmaRate ) tick ( ) { newEvents := atomic . LoadInt64 ( & r . newEvents ) atomic . AddInt64 ( & r . newEvents , - newEvents ) instantRate := float64 ( newEvents ) / r . interval . Seconds ( ) r . mutex . Lock ( ) defer r . mutex . Unlock ( ) if r . init { r . lastRate += r . alpha * ( instantRate - r . lastRate ) } else { r . init = true r . lastRate = instantRate } }
// tick assumes to be called every r.interval.
tick assumes to be called every r . interval .