Explorar o código

Benchmark for testing new EWMA.

Richard Crowley %!s(int64=12) %!d(string=hai) anos
pai
achega
4894b96c0c
Modificáronse 1 ficheiros con 8 adicións e 0 borrados
  1. 8 0
      ewma_test.go

+ 8 - 0
ewma_test.go

@@ -2,6 +2,14 @@ package metrics
 
 import "testing"
 
+func BenchmarkEWMA(b *testing.B) {
+	a := NewEWMA1()
+	for i := 0; i < b.N; i++ {
+		a.Update(1)
+		a.Tick()
+	}
+}
+
 func TestEWMA1(t *testing.T) {
 	a := NewEWMA1()
 	a.Update(3)