diff options
author | Matthew Dempsky <mdempsky@google.com> | 2022-08-04 10:12:28 -0700 |
---|---|---|
committer | Matthew Dempsky <mdempsky@google.com> | 2022-08-04 10:12:28 -0700 |
commit | d558507db42d600e5ad82748bda0cb91df57b97d (patch) | |
tree | 169457500d42144774eb68c5ab2ef70ad67aa673 /src/runtime/trace.go | |
parent | c9f2150cfb3c1db87f6434f727c25403d985a6e4 (diff) | |
parent | 85d87b9c7507628144db51bd1e7e80cc3afed128 (diff) | |
download | go-git-dev.unified.tar.gz |
[dev.unified] all: merge master (85d87b9) into dev.unifieddev.unified
Merge List:
+ 2022-08-04 85d87b9c75 all: update vendored golang.org/x dependencies for Go 1.20 development
+ 2022-08-04 fb1bfd4d37 all: remove pre-Go 1.17 workarounds
+ 2022-08-04 44ff9bff0c runtime: clean up panic and deadlock lock ranks
+ 2022-08-04 f42dc0de74 runtime: make the lock rank DAG make more sense
+ 2022-08-04 d29a0282e9 runtime: add mayAcquire annotation for finlock
+ 2022-08-04 c5be4ed7df runtime: add missing trace lock edges
+ 2022-08-04 2b8a9a484f runtime: generate the lock ranking from a DAG description
+ 2022-08-04 ddfd639408 runtime: delete unused lock ranks
+ 2022-08-04 426ea5702b internal/dag: add a Graph type and make node order deterministic
+ 2022-08-04 d37cc9a8cd go/build, internal/dag: lift DAG parser into an internal package
+ 2022-08-04 ab0a94c6d3 cmd/dist: require Go 1.17 for building Go
+ 2022-08-04 1e3c19f3fe runtime: support riscv64 SV57 mode
+ 2022-08-03 f28fa952b5 make.bat, make.rc: show bootstrap toolchain version
+ 2022-08-03 87384801dc cmd/asm: update package doc to describe "-p" option
+ 2022-08-03 c6a2dada0d net: disable TestIPv6WriteMsgUDPAddrPortTargetAddrIPVersion [sic] on DragonflyBSD
+ 2022-08-02 29b9a328d2 runtime: trivial replacements of g in remaining files
+ 2022-08-02 c647264619 runtime: trivial replacements of g in signal_unix.go
+ 2022-08-02 399f50c9d7 runtime: tricky replacements of g in traceback.go
+ 2022-08-02 4509e951ec runtime: tricky replacements of g in proc.go
+ 2022-08-02 4400238ec8 runtime: trivial replacements of _g_ in remaining files
+ 2022-08-02 5999a28de8 runtime: trivial replacements of _g_ in os files
+ 2022-08-02 0e18cf6d09 runtime: trivial replacements of _g_ in GC files
+ 2022-08-02 4358a53a97 runtime: trivial replacements of _g_ in proc.go
+ 2022-08-02 b486518964 runtime: tricky replacements of _g_ in os3_solaris.go
+ 2022-08-02 54a0ab3f7b runtime: tricky replacements of _g_ in os3_plan9.go
+ 2022-08-02 4240ff764b runtime: tricky replacements of _g_ in signal_windows.go
+ 2022-08-02 8666d89ca8 runtime: tricky replacements of _g_ in signal_unix.go
+ 2022-08-02 74cee276fe runtime: tricky replacements of _g_ in trace.go
+ 2022-08-02 222799fde6 runtime: tricky replacements of _g_ in mgc.go
+ 2022-08-02 e9d7f54a1a runtime: tricky replacements of _g_ in proc.go
+ 2022-08-02 5e8d261918 runtime: rename _p_ to pp
+ 2022-08-02 0ad2ec6596 runtime: clean up dopanic_m
+ 2022-08-02 7e952962df runtime: clean up canpanic
+ 2022-08-02 9dbc0f3556 runtime: fix outdated g.m comment in traceback.go
+ 2022-08-02 d723df76da internal/goversion: update Version to 1.20
+ 2022-08-02 1b7e71e8ae all: disable tests that fail on Alpine
+ 2022-08-01 f2a9f3e2e0 test: improve generic type assertion test
+ 2022-08-01 27038b70f8 cmd/compile: fix wrong dict pass condition for type assertions
+ 2022-08-01 e99f53fed9 doc: move Go 1.19 release notes to x/website
+ 2022-08-01 8b13a073a1 doc: mention removal of cmd/compile's -importmap and -installsuffix flags
+ 2022-08-01 e95fd4c238 doc/go1.19: fix typo: EM_LONGARCH -> EM_LOONGARCH
+ 2022-08-01 dee3efd9f8 doc/go1.19: fix a few links that were missing trailing slashes
+ 2022-07-30 f32519e5fb runtime: fix typos
+ 2022-07-29 9a2001a8cc cmd/dist: always pass -short=true with -quick
+ 2022-07-28 5c8ec89cb5 doc/go1.19: minor adjustments and links
+ 2022-07-28 417be37048 doc/go1.19: improve the loong64 release notes
+ 2022-07-28 027855e8d8 os/exec: add GODEBUG setting to opt out of ErrDot changes
Change-Id: Idc0fbe93978c0dff7600b90a2c3ecc067fd9f5f2
Diffstat (limited to 'src/runtime/trace.go')
-rw-r--r-- | src/runtime/trace.go | 85 |
1 files changed, 41 insertions, 44 deletions
diff --git a/src/runtime/trace.go b/src/runtime/trace.go index 10436d80c2..9b12b42f11 100644 --- a/src/runtime/trace.go +++ b/src/runtime/trace.go @@ -232,14 +232,12 @@ func StartTrace() error { // - or GoSysExit appears for a goroutine for which we don't emit EvGoInSyscall below. // To instruct traceEvent that it must not ignore events below, we set startingtrace. // trace.enabled is set afterwards once we have emitted all preliminary events. - _g_ := getg() - _g_.m.startingtrace = true + mp := getg().m + mp.startingtrace = true // Obtain current stack ID to use in all traceEvGoCreate events below. - mp := acquirem() stkBuf := make([]uintptr, traceStackSize) stackID := traceStackID(mp, stkBuf, 2) - releasem(mp) profBuf := newProfBuf(2, profBufWordCount, profBufTagCount) // after the timestamp, header is [pp.id, gp.goid] trace.cpuLogRead = profBuf @@ -293,7 +291,7 @@ func StartTrace() error { trace.strings = make(map[string]uint64) trace.seqGC = 0 - _g_.m.startingtrace = false + mp.startingtrace = false trace.enabled = true // Register runtime goroutine labels. @@ -782,19 +780,18 @@ func traceReadCPU() { } func traceStackID(mp *m, buf []uintptr, skip int) uint64 { - _g_ := getg() - gp := mp.curg + gp := getg() + curgp := mp.curg var nstk int - if gp == _g_ { + if curgp == gp { nstk = callers(skip+1, buf) - } else if gp != nil { - gp = mp.curg - nstk = gcallers(gp, skip, buf) + } else if curgp != nil { + nstk = gcallers(curgp, skip, buf) } if nstk > 0 { nstk-- // skip runtime.goexit } - if nstk > 0 && gp.goid == 1 { + if nstk > 0 && curgp.goid == 1 { nstk-- // skip runtime.main } id := trace.stackTab.put(buf[:nstk]) @@ -1208,11 +1205,11 @@ func traceGCSTWDone() { func traceGCSweepStart() { // Delay the actual GCSweepStart event until the first span // sweep. If we don't sweep anything, don't emit any events. - _p_ := getg().m.p.ptr() - if _p_.traceSweep { + pp := getg().m.p.ptr() + if pp.traceSweep { throw("double traceGCSweepStart") } - _p_.traceSweep, _p_.traceSwept, _p_.traceReclaimed = true, 0, 0 + pp.traceSweep, pp.traceSwept, pp.traceReclaimed = true, 0, 0 } // traceGCSweepSpan traces the sweep of a single page. @@ -1220,24 +1217,24 @@ func traceGCSweepStart() { // This may be called outside a traceGCSweepStart/traceGCSweepDone // pair; however, it will not emit any trace events in this case. func traceGCSweepSpan(bytesSwept uintptr) { - _p_ := getg().m.p.ptr() - if _p_.traceSweep { - if _p_.traceSwept == 0 { + pp := getg().m.p.ptr() + if pp.traceSweep { + if pp.traceSwept == 0 { traceEvent(traceEvGCSweepStart, 1) } - _p_.traceSwept += bytesSwept + pp.traceSwept += bytesSwept } } func traceGCSweepDone() { - _p_ := getg().m.p.ptr() - if !_p_.traceSweep { + pp := getg().m.p.ptr() + if !pp.traceSweep { throw("missing traceGCSweepStart") } - if _p_.traceSwept != 0 { - traceEvent(traceEvGCSweepDone, -1, uint64(_p_.traceSwept), uint64(_p_.traceReclaimed)) + if pp.traceSwept != 0 { + traceEvent(traceEvGCSweepDone, -1, uint64(pp.traceSwept), uint64(pp.traceReclaimed)) } - _p_.traceSweep = false + pp.traceSweep = false } func traceGCMarkAssistStart() { @@ -1257,16 +1254,16 @@ func traceGoCreate(newg *g, pc uintptr) { } func traceGoStart() { - _g_ := getg().m.curg - _p_ := _g_.m.p - _g_.traceseq++ - if _p_.ptr().gcMarkWorkerMode != gcMarkWorkerNotWorker { - traceEvent(traceEvGoStartLabel, -1, uint64(_g_.goid), _g_.traceseq, trace.markWorkerLabels[_p_.ptr().gcMarkWorkerMode]) - } else if _g_.tracelastp == _p_ { - traceEvent(traceEvGoStartLocal, -1, uint64(_g_.goid)) + gp := getg().m.curg + pp := gp.m.p + gp.traceseq++ + if pp.ptr().gcMarkWorkerMode != gcMarkWorkerNotWorker { + traceEvent(traceEvGoStartLabel, -1, uint64(gp.goid), gp.traceseq, trace.markWorkerLabels[pp.ptr().gcMarkWorkerMode]) + } else if gp.tracelastp == pp { + traceEvent(traceEvGoStartLocal, -1, uint64(gp.goid)) } else { - _g_.tracelastp = _p_ - traceEvent(traceEvGoStart, -1, uint64(_g_.goid), _g_.traceseq) + gp.tracelastp = pp + traceEvent(traceEvGoStart, -1, uint64(gp.goid), gp.traceseq) } } @@ -1275,14 +1272,14 @@ func traceGoEnd() { } func traceGoSched() { - _g_ := getg() - _g_.tracelastp = _g_.m.p + gp := getg() + gp.tracelastp = gp.m.p traceEvent(traceEvGoSched, 1) } func traceGoPreempt() { - _g_ := getg() - _g_.tracelastp = _g_.m.p + gp := getg() + gp.tracelastp = gp.m.p traceEvent(traceEvGoPreempt, 1) } @@ -1294,12 +1291,12 @@ func traceGoPark(traceEv byte, skip int) { } func traceGoUnpark(gp *g, skip int) { - _p_ := getg().m.p + pp := getg().m.p gp.traceseq++ - if gp.tracelastp == _p_ { + if gp.tracelastp == pp { traceEvent(traceEvGoUnblockLocal, skip, uint64(gp.goid)) } else { - gp.tracelastp = _p_ + gp.tracelastp = pp traceEvent(traceEvGoUnblock, skip, uint64(gp.goid), gp.traceseq) } } @@ -1321,10 +1318,10 @@ func traceGoSysExit(ts int64) { // aka right now), and assign a fresh time stamp to keep the log consistent. ts = 0 } - _g_ := getg().m.curg - _g_.traceseq++ - _g_.tracelastp = _g_.m.p - traceEvent(traceEvGoSysExit, -1, uint64(_g_.goid), _g_.traceseq, uint64(ts)/traceTickDiv) + gp := getg().m.curg + gp.traceseq++ + gp.tracelastp = gp.m.p + traceEvent(traceEvGoSysExit, -1, uint64(gp.goid), gp.traceseq, uint64(ts)/traceTickDiv) } func traceGoSysBlock(pp *p) { |