Skip to content

Latest commit

 

History

History
28 lines (20 loc) · 1.02 KB

File metadata and controls

28 lines (20 loc) · 1.02 KB

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())
}