import (
"flag"
"fmt"
- "internal/race"
"internal/sysinfo"
"io"
"math"
func (b *B) runN(n int) {
benchmarkLock.Lock()
defer benchmarkLock.Unlock()
- defer b.runCleanup(normalPanic)
+ defer func() {
+ b.runCleanup(normalPanic)
+ b.checkRaces()
+ }()
// Try to get a comparable environment for each run
// by clearing garbage from previous runs.
runtime.GC()
- b.raceErrors = -race.Errors()
+ b.resetRaces()
b.N = n
b.parallelism = 1
b.ResetTimer()
b.StopTimer()
b.previousN = n
b.previousDuration = b.duration
- b.raceErrors += race.Errors()
- if b.raceErrors > 0 {
- b.Errorf("race detected during execution of benchmark")
- }
}
// run1 runs the first iteration of benchFunc. It reports whether more