diff --git a/example_multi_test.go b/example_multi_test.go new file mode 100644 index 0000000..9aa4a88 --- /dev/null +++ b/example_multi_test.go @@ -0,0 +1,21 @@ +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 +}