mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
runtime/pprof: fix flaky TestCPUProfileMultithreaded test
It's too sensitive. Fixes bug 7095 R=golang-codereviews, iant, minux.ma, rsc CC=golang-codereviews https://golang.org/cl/50470043
This commit is contained in:
parent
6e8b4920c1
commit
cefe6ac9a1
1 changed files with 5 additions and 1 deletions
|
|
@ -142,7 +142,11 @@ func testCPUProfile(t *testing.T, need []string, f func()) {
|
||||||
t.Logf("no CPU profile samples collected")
|
t.Logf("no CPU profile samples collected")
|
||||||
ok = false
|
ok = false
|
||||||
}
|
}
|
||||||
min := total / uintptr(len(have)) / 3
|
// We'd like to check a reasonable minimum, like
|
||||||
|
// total / len(have) / smallconstant, but this test is
|
||||||
|
// pretty flaky (see bug 7095). So we'll just test to
|
||||||
|
// make sure we got at least one sample.
|
||||||
|
min := uintptr(1)
|
||||||
for i, name := range need {
|
for i, name := range need {
|
||||||
if have[i] < min {
|
if have[i] < min {
|
||||||
t.Logf("%s has %d samples out of %d, want at least %d, ideally %d", name, have[i], total, min, total/uintptr(len(have)))
|
t.Logf("%s has %d samples out of %d, want at least %d, ideally %d", name, have[i], total, min, total/uintptr(len(have)))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue