aboutsummaryrefslogtreecommitdiff
path: root/src/cmd
diff options
context:
space:
mode:
authorMichael Anthony Knyszek <mknyszek@google.com>2023-05-11 21:09:10 +0000
committerMichael Knyszek <mknyszek@google.com>2023-05-19 17:06:45 +0000
commitb1aadd034c1feb6ac8409aca5f0efd10ef442950 (patch)
tree4872646599671579df0c82627204881bebd087e2 /src/cmd
parent944911af5630bec413237b9aba010661a353953e (diff)
downloadgo-b1aadd034c1feb6ac8409aca5f0efd10ef442950.tar.xz
runtime: emit STW events for all pauses, not just those for the GC
Currently STW events are only emitted for GC STWs. There's little reason why the trace can't contain events for every STW: they're rare so don't take up much space in the trace, yet being able to see when the world was stopped is often critical to debugging certain latency issues, especially when they stem from user-level APIs. This change adds new "kinds" to the EvGCSTWStart event, renames the GCSTW events to just "STW," and lets the parser deal with unknown STW kinds for future backwards compatibility. But, this change must break trace compatibility, so it bumps the trace version to Go 1.21. This change also includes a small cleanup in the trace command, which previously checked for STW events when deciding whether user tasks overlapped with a GC. Looking at the source, I don't see a way for STW events to ever enter the stream that that code looks at, so that condition has been deleted. Change-Id: I9a5dc144092c53e92eb6950e9a5504a790ac00cf Reviewed-on: https://go-review.googlesource.com/c/go/+/494495 Reviewed-by: Michael Pratt <mpratt@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Michael Knyszek <mknyszek@google.com>
Diffstat (limited to 'src/cmd')
-rw-r--r--src/cmd/trace/annotations.go2
-rw-r--r--src/cmd/trace/trace.go4
2 files changed, 3 insertions, 3 deletions
diff --git a/src/cmd/trace/annotations.go b/src/cmd/trace/annotations.go
index 9ffce1b187..0addc240be 100644
--- a/src/cmd/trace/annotations.go
+++ b/src/cmd/trace/annotations.go
@@ -494,7 +494,7 @@ func (region *regionDesc) duration() time.Duration {
func (task *taskDesc) overlappingGCDuration(evs []*trace.Event) (overlapping time.Duration) {
for _, ev := range evs {
// make sure we only consider the global GC events.
- if typ := ev.Type; typ != trace.EvGCStart && typ != trace.EvGCSTWStart {
+ if typ := ev.Type; typ != trace.EvGCStart {
continue
}
diff --git a/src/cmd/trace/trace.go b/src/cmd/trace/trace.go
index 895129998f..618df42033 100644
--- a/src/cmd/trace/trace.go
+++ b/src/cmd/trace/trace.go
@@ -764,12 +764,12 @@ func generateTrace(params *traceParams, consumer traceConsumer) error {
case trace.EvGCStart:
ctx.emitSlice(ev, "GC")
case trace.EvGCDone:
- case trace.EvGCSTWStart:
+ case trace.EvSTWStart:
if ctx.mode&modeGoroutineOriented != 0 {
continue
}
ctx.emitSlice(ev, fmt.Sprintf("STW (%s)", ev.SArgs[0]))
- case trace.EvGCSTWDone:
+ case trace.EvSTWDone:
case trace.EvGCMarkAssistStart:
// Mark assists can continue past preemptions, so truncate to the
// whichever comes first. We'll synthesize another slice if