mirror of
https://github.com/golang/go.git
synced 2026-02-04 01:45:06 +03:00
runtime: use m.profStack in traceStack
Turns out we spend a few percent of the trace event writing path in just zero-initializing the stack space for pcBuf. We don't need zero initialization, since we're going to write over whatever we actually use. Use m.profStack instead, which is already sized correctly. A side-effect of this change is that trace stacks now obey the GODEBUG profstackdepth where they previously ignored it. The name clearly doesn't match, but this is a positive: there's no reason the maximum stack depth shouldn't apply to every diagnostic. Change-Id: Ia654d3d708f15cbb2e1d95af196ae10b07a65df2 Reviewed-on: https://go-review.googlesource.com/c/go/+/723062 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Pratt <mpratt@google.com> Auto-Submit: Michael Knyszek <mknyszek@google.com>
This commit is contained in:
committed by
Gopher Robot
parent
0bc192368a
commit
7fbd141de5
@@ -30,7 +30,7 @@ const (
|
||||
//
|
||||
// Avoid calling this function directly. Prefer traceEventWriter.stack.
|
||||
func traceStack(skip int, gp *g, tab *traceStackTable) uint64 {
|
||||
var pcBuf [tracev2.MaxFramesPerStack]uintptr
|
||||
pcBuf := getg().m.profStack
|
||||
|
||||
// Figure out gp and mp for the backtrace.
|
||||
var mp *m
|
||||
|
||||
Reference in New Issue
Block a user