Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(335)

Unified Diff: src/pkg/exp/html/token_test.go

Issue 7027046: code review 7027046: testing: introduce (*B).EnableMallocReport() (Closed)
Patch Set: diff -r a55bd9f21507 https://code.google.com/p/go/ Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/pkg/exp/html/parse_test.go ('k') | src/pkg/testing/benchmark.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pkg/exp/html/token_test.go
===================================================================
--- a/src/pkg/exp/html/token_test.go
+++ b/src/pkg/exp/html/token_test.go
@@ -634,9 +634,7 @@
}
b.SetBytes(int64(len(buf)))
runtime.GC()
- var ms runtime.MemStats
- runtime.ReadMemStats(&ms)
- mallocs := ms.Mallocs
+ b.ReportAllocs()
b.ResetTimer()
for i := 0; i < b.N; i++ {
z := NewTokenizer(bytes.NewBuffer(buf))
@@ -674,10 +672,6 @@
}
}
}
- b.StopTimer()
- runtime.ReadMemStats(&ms)
- mallocs = ms.Mallocs - mallocs
- b.Logf("%d iterations, %d mallocs per iteration\n", b.N, int(mallocs)/b.N)
}
func BenchmarkRawLevelTokenizer(b *testing.B) { benchmarkTokenizer(b, rawLevel) }
« no previous file with comments | « src/pkg/exp/html/parse_test.go ('k') | src/pkg/testing/benchmark.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b