diff --git a/model/textparse/promparse_test.go b/model/textparse/promparse_test.go index fa03e7c96..6a1216da1 100644 --- a/model/textparse/promparse_test.go +++ b/model/textparse/promparse_test.go @@ -367,7 +367,7 @@ func BenchmarkParse(b *testing.B) { b.Run(parserName+"/no-decode-metric/"+fn, func(b *testing.B) { total := 0 - b.SetBytes(int64(len(buf) * (b.N / promtestdataSampleCount))) + b.SetBytes(int64(len(buf) / promtestdataSampleCount)) b.ReportAllocs() b.ResetTimer() @@ -395,7 +395,7 @@ func BenchmarkParse(b *testing.B) { b.Run(parserName+"/decode-metric/"+fn, func(b *testing.B) { total := 0 - b.SetBytes(int64(len(buf) * (b.N / promtestdataSampleCount))) + b.SetBytes(int64(len(buf) / promtestdataSampleCount)) b.ReportAllocs() b.ResetTimer() @@ -428,7 +428,7 @@ func BenchmarkParse(b *testing.B) { total := 0 res := make(labels.Labels, 0, 5) - b.SetBytes(int64(len(buf) * (b.N / promtestdataSampleCount))) + b.SetBytes(int64(len(buf) / promtestdataSampleCount)) b.ReportAllocs() b.ResetTimer() @@ -458,7 +458,10 @@ func BenchmarkParse(b *testing.B) { _ = total }) b.Run("expfmt-text/"+fn, func(b *testing.B) { - b.SetBytes(int64(len(buf) * (b.N / promtestdataSampleCount))) + if parserName != "prometheus" { + b.Skip() + } + b.SetBytes(int64(len(buf) / promtestdataSampleCount)) b.ReportAllocs() b.ResetTimer() @@ -507,7 +510,7 @@ func BenchmarkGzip(b *testing.B) { k := b.N / promtestdataSampleCount b.ReportAllocs() - b.SetBytes(int64(k) * int64(n)) + b.SetBytes(int64(n) / promtestdataSampleCount) b.ResetTimer() total := 0 diff --git a/storage/buffer_test.go b/storage/buffer_test.go index d849ed163..021197a77 100644 --- a/storage/buffer_test.go +++ b/storage/buffer_test.go @@ -176,7 +176,7 @@ func BenchmarkBufferedSeriesIterator(b *testing.B) { // Simulate a 5 minute rate. it := NewBufferIterator(newFakeSeriesIterator(int64(b.N), 30), 5*60) - b.SetBytes(int64(b.N * 16)) + b.SetBytes(16) b.ReportAllocs() b.ResetTimer() diff --git a/storage/memoized_iterator_test.go b/storage/memoized_iterator_test.go index f606f2fae..ae1c57be4 100644 --- a/storage/memoized_iterator_test.go +++ b/storage/memoized_iterator_test.go @@ -75,7 +75,7 @@ func BenchmarkMemoizedSeriesIterator(b *testing.B) { // Simulate a 5 minute rate. it := NewMemoizedIterator(newFakeSeriesIterator(int64(b.N), 30), 5*60) - b.SetBytes(int64(b.N * 16)) + b.SetBytes(16) b.ReportAllocs() b.ResetTimer()