bps/readme.md

17 lines
468 B
Markdown
Raw Permalink Normal View History

# bps
2014-03-02 23:10:16 -08:00
2016-09-22 23:03:32 -07:00
[![GoDoc](https://godoc.org/mcquay.me/bps?status.svg)](https://godoc.org/mcquay.me/bps)
2016-02-25 23:25:56 -08:00
`bps` is used to keep track of bandwidth rates
2014-03-02 23:10:16 -08:00
It is intended to be used as such:
2015-09-30 23:12:14 -07:00
// report on the rate over a 60 second interval, update every second
bw, _ := New(60*time.Second)
bw.Add(10)
b := &bytes.Buffer{}
b.Write([]byte("helloooooooooooooooooooooooooooooooooooooooooooooo"))
io.Copy(bw, b)
2014-03-02 23:10:16 -08:00
time.Sleep(1 * time.Second)
2015-09-30 23:12:14 -07:00
log.Printf("%+v", bw.HumanRate())