bps is used to keep track of bandwidth rates
https://godoc.org/mcquay.me/bps
Stephen McQuay
bb8ce3c1ea
After talks on #go-nuts, it seems as though I should look into using something like the following: https://github.com/cespare/goproc/tree/master/nwstat And this makes sense. I have trimmed out the old tests and rearranged some code here. |
||
---|---|---|
.hgignore | ||
bandwidth_test.go | ||
bandwidth.go | ||
license.md | ||
readme.md |
bandwidth
bandwidth
is a little package to be used in collecting and reporting on bandwidth numbers.
It is intended to be used as such:
// report on 1, 10, 60 second intervals, update every 100 milliseconds
bw, _ := NewBandwidth([]int{1, 10, 60}, 100*time.Millisecond)
go bw.Run()
bw.AddRx <- 10
bw.AddTx <- 10
time.Sleep(1 * time.Second)
log.Printf("%+v", <-bw.Rx)
log.Printf("%+v", <-bw.Tx)