From 82329b5882f4806aa916ddac9c570a8b9d2e1b29 Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Sun, 28 Oct 2012 13:07:42 +0100 Subject: [PATCH] rollsum: log stats after benchmark run Change-Id: I2c8983d13ea80efb383ebf77316e6ad0a5da9f57 --- pkg/rollsum/rollsum_test.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pkg/rollsum/rollsum_test.go b/pkg/rollsum/rollsum_test.go index 3d5804ed0..df6aaadd1 100644 --- a/pkg/rollsum/rollsum_test.go +++ b/pkg/rollsum/rollsum_test.go @@ -57,15 +57,17 @@ func TestSum(t *testing.T) { func BenchmarkRollsum(b *testing.B) { bytesSize := int64(1024 * 1024 * 5) rs := New() - bits := 0 + splits := 0 for i := 0; i < b.N; i++ { + splits = 0 for j := int64(0); j < bytesSize; j++ { rs.Roll(byte(rand.Int63() & 0xff)) if rs.OnSplit() { - bits = rs.Bits() + _ = rs.Bits() + splits++ } } } b.SetBytes(bytesSize) - _ = bits + b.Logf("num splits = %d; every %d bytes", splits, int(float64(bytesSize) / float64(splits))) }