Skip to content

Double sliding window to calculate item processing speed

License

Notifications You must be signed in to change notification settings

aidenesco/progress

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Progress PkgGoDev Go Report Card

This package uses a double sliding window to calculate item processing speed.

Due to the package's double sliding window design, fluctuations are smoothed out for a more accurate measurement of average speed. This design also means that the average isnt at its most stable until the window is full of data.

This code was inspired and derived from average and slidingwindow

Installation

go get -u github.com/aidenesco/progress

Usage

import "github.com/aidenesco/progress"

func main() {
    w := progress.NewWindow(time.Hour, time.Minute)
    defer w.End()
    
    for i := 0; i < 10; i++ {
        w.ItemCompleted()
    }
    
    fmt.Println(w.Average())
}

About

Double sliding window to calculate item processing speed

Topics

Resources

License

Stars

Watchers

Forks

Languages