metrics: add benchmarks

This commit is contained in:
Martin Holst Swende 2023-08-30 14:22:44 +02:00
parent 53f3c2ae65
commit 769aad4126
No known key found for this signature in database
GPG key ID: 683B438C05A5DDF0

View file

@ -14,6 +14,18 @@ func BenchmarkEWMA(b *testing.B) {
}
}
func BenchmarkEWMAParallel(b *testing.B) {
a := NewEWMA1()
b.ResetTimer()
b.RunParallel(func(pb *testing.PB) {
for pb.Next() {
a.Update(1)
a.Tick()
}
})
}
func TestEWMA1(t *testing.T) {
a := NewEWMA1()
a.Update(3)