Skip to content

Latest commit

 

History

History
16 lines (9 loc) · 278 Bytes

readme.md

File metadata and controls

16 lines (9 loc) · 278 Bytes

timecounter

基于时间轮思想进行短时间的时序统计。 见 https://juejin.cn/post/7305013302416244774

用法:

counter := NewCounter(10 * time.Minute, 100)

counter.PutNow(1)
counter.PutN(time.Now(), 10)

fmt.Println(counter.SumAll()) // output: 11