22 lines
347 B
Go
22 lines
347 B
Go
package bps
|
|
|
|
import (
|
|
"fmt"
|
|
"log"
|
|
"time"
|
|
)
|
|
|
|
func ExampleMulti() {
|
|
// Create a Multi that records information for 1s, 10s, and 1m
|
|
bw, err := NewMulti(1*time.Second, 10*time.Second, 1*time.Minute)
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
|
|
// Add some data, then print out rates;w
|
|
bw.Add(1)
|
|
fmt.Printf("%v\n", len(bw.Rate()))
|
|
// Output:
|
|
// 3
|
|
}
|