Commit a19e638d authored by Alex Brainman's avatar Alex Brainman Committed by Russ Cox

runtime/pprof: adjust cpuHogger so that tests pass on windows builders

LGTM=rsc
R=dvyukov, rsc
CC=golang-codereviews
https://golang.org/cl/140110043
parent 20d9cc4b
......@@ -23,12 +23,12 @@ import (
func cpuHogger(f func()) {
// We only need to get one 100 Hz clock tick, so we've got
// a 25x safety buffer.
// But do at least 500 iterations (which should take about 100ms),
// a 100x safety buffer.
// But do at least 2000 iterations (which should take about 400ms),
// otherwise TestCPUProfileMultithreaded can fail if only one
// thread is scheduled during the 250ms period.
// thread is scheduled during the 1 second period.
t0 := time.Now()
for i := 0; i < 500 || time.Since(t0) < 250*time.Millisecond; i++ {
for i := 0; i < 2000 || time.Since(t0) < time.Second; i++ {
f()
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment