mirror of
https://github.com/golang/go
synced 2024-11-19 21:24:40 -07:00
undo CL 140110043 / 17b5fc2aa130
I have found better approach, then longer wait. See CL 134360043 for details. ««« original CL description runtime/pprof: adjust cpuHogger so that tests pass on windows builders LGTM=rsc R=dvyukov, rsc CC=golang-codereviews https://golang.org/cl/140110043 »»» LGTM=dave R=golang-codereviews, dave, dvyukov CC=golang-codereviews https://golang.org/cl/133500043
This commit is contained in:
parent
bffb0590c1
commit
d72029e3a3
@ -23,12 +23,12 @@ import (
|
|||||||
|
|
||||||
func cpuHogger(f func()) {
|
func cpuHogger(f func()) {
|
||||||
// We only need to get one 100 Hz clock tick, so we've got
|
// We only need to get one 100 Hz clock tick, so we've got
|
||||||
// a 100x safety buffer.
|
// a 25x safety buffer.
|
||||||
// But do at least 2000 iterations (which should take about 400ms),
|
// But do at least 500 iterations (which should take about 100ms),
|
||||||
// otherwise TestCPUProfileMultithreaded can fail if only one
|
// otherwise TestCPUProfileMultithreaded can fail if only one
|
||||||
// thread is scheduled during the 1 second period.
|
// thread is scheduled during the 250ms period.
|
||||||
t0 := time.Now()
|
t0 := time.Now()
|
||||||
for i := 0; i < 2000 || time.Since(t0) < time.Second; i++ {
|
for i := 0; i < 500 || time.Since(t0) < 250*time.Millisecond; i++ {
|
||||||
f()
|
f()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user