1
0
mirror of https://github.com/golang/go synced 2024-11-12 10:20:27 -07:00

testing: update package docs to use ResetTimer() instead of StopTimer/StartTimer()

R=golang-dev, rsc, r
CC=golang-dev
https://golang.org/cl/6591051
This commit is contained in:
Shenghou Ma 2012-10-03 11:41:18 +08:00
parent 7f4b4c0c00
commit 727e5ce95f

View File

@ -27,15 +27,14 @@
//
// The benchmark package will vary b.N until the benchmark function lasts
// long enough to be timed reliably. The output
// testing.BenchmarkHello 10000000 282 ns/op
// BenchmarkHello 10000000 282 ns/op
// means that the loop ran 10000000 times at a speed of 282 ns per loop.
//
// If a benchmark needs some expensive setup before running, the timer
// may be stopped:
// may be reset:
// func BenchmarkBigLen(b *testing.B) {
// b.StopTimer()
// big := NewBig()
// b.StartTimer()
// b.ResetTimer()
// for i := 0; i < b.N; i++ {
// big.Len()
// }