]> Cypherpunks repositories - gostls13.git/commit
runtime: fix missing pprof labels
authorFelix Geisendörfer <felix.geisendoerfer@datadoghq.com>
Mon, 20 Sep 2021 14:09:47 +0000 (16:09 +0200)
committerMichael Pratt <mpratt@google.com>
Fri, 3 Dec 2021 16:11:38 +0000 (16:11 +0000)
commit9b0de0854d5a5655890ef0b2b9052da2541182a3
treed456c70958a04f01aeffbf5fa713724d75e7a0af
parenta174638a5cc88eb4fccaaa699990f5626fbb0e30
runtime: fix missing pprof labels

Use gp.m.curg instead of the gp when recording cpu profiler stack
traces. This ensures profiler labels are captured when systemstack or similar
is executing on behalf of the current goroutine.

After this there are still rare cases of samples containing the labelHog
function, so more work might be needed. This patch should fix ~99% of the
problem.

Also change testCPUProfile interface a little to allow the new test to
re-run with a longer duration if it fails during a -short run.

Fixes #48577.

Change-Id: I3dbc9fd5af3c513544e822acaa43055b2e00dfa9
Reviewed-on: https://go-review.googlesource.com/c/go/+/367200
Trust: Michael Pratt <mpratt@google.com>
Trust: Bryan Mills <bcmills@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
src/runtime/cpuprof.go
src/runtime/pprof/pprof_test.go
src/runtime/proc.go