aboutsummaryrefslogtreecommitdiff
path: root/test/heapsampling.go
AgeCommit message (Collapse)Author
2019-03-07test: improve test coverage for heap samplingRaul Silvera
Update the test in test/heapsampling.go to more thoroughly validate heap sampling. Lower the sampling rate on the test to ensure allocations both smaller and larger than the sampling rate are tested. Tighten up the validation check to a 10% difference between the unsampled and correct value. Because of the nature of random sampling, it is possible that the unsampled value fluctuates over that range. To avoid flakes, run the experiment three times and only report an issue if the same location consistently falls out of range on all experiments. This tests the sampling fix in cl/158337. Change-Id: I54a709e5c75827b8b1c2d87cdfb425ab09759677 GitHub-Last-Rev: 7c04f126034f9e323efc220c896d75e7984ffd39 GitHub-Pull-Request: golang/go#26944 Reviewed-on: https://go-review.googlesource.com/c/go/+/129117 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com>
2015-11-12test: really force heap profile update in heapsampling.goAustin Clements
The heap profile is only guaranteed to be up-to-date after two GC cycles, so force two GCs instead of just one. Updates #13098. Change-Id: I4fb9287b698f4a3b90b8af9fc6a2efb3b082bfe5 Reviewed-on: https://go-review.googlesource.com/16848 Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
2015-11-12test: force heap profile update in heapsampling.go testAustin Clements
The heapsampling.go test occasionally fails on some architectures because it finds zero heap samples in main.alloc. This happens because the byte and object counts are only updated at a GC. Hence, if a GC happens part way through allocInterleaved, but then doesn't happen after we start calling main.alloc, checkAllocations will see buckets for the lines in main.alloc (which are created eagerly), but the object and byte counts will be zero. Fix this by forcing a GC to update the profile before we collect it. Fixes #13098. Change-Id: Ia7a9918eea6399307f10499dd7abefd4f6d13cf6 Reviewed-on: https://go-review.googlesource.com/16846 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
2015-10-30test: disable flaky heapsampling test for nowBrad Fitzpatrick
Flaky tests do more harm than good. Updates #13098 Change-Id: I179ed810b49bbb96c8df462bfa20b70231b26772 Reviewed-on: https://go-review.googlesource.com/16521 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-10-05pprof: improve sampling for heap profilingRaul Silvera
The current heap sampling introduces some bias that interferes with unsampling, producing unexpected heap profiles. The solution is to use a Poisson process to generate the sampling points, using the formulas described at https://en.wikipedia.org/wiki/Poisson_process This fixes #12620 Change-Id: If2400809ed3c41de504dd6cff06be14e476ff96c Reviewed-on: https://go-review.googlesource.com/14590 Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Minux Ma <minux@golang.org> Run-TryBot: Minux Ma <minux@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>