1
0
mirror of https://github.com/golang/go synced 2024-11-23 07:00:05 -07:00

runtime: hide trace lock init details

This change is in service of hiding more execution trace implementation
details for big changes to come.

Change-Id: I49b9716a7bf285d23c86b58912a05eff4ddc2213
Reviewed-on: https://go-review.googlesource.com/c/go/+/494182
Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
Michael Anthony Knyszek 2023-05-09 19:48:29 +00:00 committed by Gopher Robot
parent 446ad131f6
commit a2737b1aab
2 changed files with 9 additions and 4 deletions

View File

@ -691,11 +691,8 @@ func schedinit() {
lockInit(&allpLock, lockRankAllp)
lockInit(&reflectOffs.lock, lockRankReflectOffs)
lockInit(&finlock, lockRankFin)
lockInit(&trace.bufLock, lockRankTraceBuf)
lockInit(&trace.stringsLock, lockRankTraceStrings)
lockInit(&trace.lock, lockRankTrace)
lockInit(&cpuprof.lock, lockRankCpuprof)
lockInit(&trace.stackTab.lock, lockRankTraceStackTab)
traceLockInit()
// Enforce that this lock is always a leaf lock.
// All of this lock's critical sections should be
// extremely short.

View File

@ -168,6 +168,14 @@ var trace struct {
buf traceBufPtr // global trace buffer, used when running without a p
}
// traceLockInit initializes global trace locks.
func traceLockInit() {
lockInit(&trace.bufLock, lockRankTraceBuf)
lockInit(&trace.stringsLock, lockRankTraceStrings)
lockInit(&trace.lock, lockRankTrace)
lockInit(&trace.stackTab.lock, lockRankTraceStackTab)
}
// traceBufHeader is per-P tracing buffer.
type traceBufHeader struct {
link traceBufPtr // in trace.empty/full