aboutsummaryrefslogtreecommitdiff
path: root/src/runtime
diff options
context:
space:
mode:
authorMichael Anthony Knyszek <mknyszek@google.com>2025-01-09 18:17:49 +0000
committerGopher Robot <gobot@golang.org>2025-02-07 12:12:33 -0800
commitca1cfea3710a5873132d0c5f6e3710804714efd4 (patch)
treef2f521159fdf5f3a73a2f2a19f2e02ec1a4cf697 /src/runtime
parentd7f6f6fd54bb888606d882cd73df9dcac229b80a (diff)
downloadgo-ca1cfea3710a5873132d0c5f6e3710804714efd4.tar.xz
internal/trace: refactor how experimental batches are exposed
This change modifies how per-generation experimental batches are exposed. Rather than expose them on the ExperimentalEvent, it exposes it as part of the Sync event, so it's clear to the caller when the information becomes relevant and when it should be parsed. This change also adds a field to each ExperimentalEvent indicating which experiment the event is a part of. Because this information needs to appear *before* a generation is observed, we now ensure there is a sync event both before and after each generation. This means the final sync event is now a special case; previously we would only emit a sync event after each generation. This change is based on feedback from Austin Clements on the experimental events functionality. For #62627. Change-Id: I48b0fe12b22abb7ac8820a9e73447bfed8419856 Reviewed-on: https://go-review.googlesource.com/c/go/+/644215 Auto-Submit: Michael Knyszek <mknyszek@google.com> Reviewed-by: Michael Pratt <mpratt@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/runtime')
-rw-r--r--src/runtime/crash_test.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/runtime/crash_test.go b/src/runtime/crash_test.go
index c390218355..fcf5ef85ce 100644
--- a/src/runtime/crash_test.go
+++ b/src/runtime/crash_test.go
@@ -990,7 +990,8 @@ func TestCrashWhileTracing(t *testing.T) {
if err != nil {
t.Fatalf("could not create trace.NewReader: %v", err)
}
- var seen, seenSync bool
+ var seen bool
+ nSync := 0
i := 1
loop:
for ; ; i++ {
@@ -1005,7 +1006,7 @@ loop:
}
switch ev.Kind() {
case traceparse.EventSync:
- seenSync = true
+ nSync = ev.Sync().N
case traceparse.EventLog:
v := ev.Log()
if v.Category == "xyzzy-cat" && v.Message == "xyzzy-msg" {
@@ -1019,7 +1020,7 @@ loop:
if err := cmd.Wait(); err == nil {
t.Error("the process should have panicked")
}
- if !seenSync {
+ if nSync <= 1 {
t.Errorf("expected at least one full generation to have been emitted before the trace was considered broken")
}
if !seen {