Added BPS.Data to feed to sparklines

This commit is contained in:
sm
2016-02-27 23:03:42 -08:00
parent b0803ee1b7
commit 9e977f19c6
2 changed files with 112 additions and 0 deletions
+9
View File
@@ -127,3 +127,12 @@ func (b *BPS) Close() {
close(b.quit)
<-b.closed
}
// Data returns an slice of all the buckets, the most recent bucket first.
func (b *BPS) Data() []int {
r := []int{}
for i := len(b.buckets) - 1; i >= 0; i-- {
r = append(r, int(b.buckets[(b.timeI+i)%len(b.buckets)]))
}
return r
}