bps is used to keep track of bandwidth rates https://godoc.org/mcquay.me/bps
Go to file
stephen mcquay 0ad73b982e bandwidth -> bps, and behavior change
- bps.BPS only keeps track of rates of a single rate
- bps.BPS implements io.Writer
- removed chan semantics, interact via .Add or .Write
- fleshed out docs
2015-09-29 23:38:14 -07:00
bandwidth_test.go bandwidth -> bps, and behavior change 2015-09-29 23:38:14 -07:00
bandwidth.go bandwidth -> bps, and behavior change 2015-09-29 23:38:14 -07:00
license changed license 2015-06-22 19:32:30 -07:00
readme.md bandwidth -> bps, and behavior change 2015-09-29 23:38:14 -07:00

bps

bps is used to keep track of rates

It is intended to be used as such:

// report on 1, 10, 60 second intervals, update every second
bw, _ := NewBandwidth([]int{1, 10, 60}, time.Second)
bw.Add(10)
b := &bytes.Buffer{}
b.Write([]byte("helloooooooooooooooooooooooooooooooooooooooooooooo"))
io.Copy(bw, b)
time.Sleep(1 * time.Second)
log.Printf("%+v", bw.Cur())