1 // Copyright 2023 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
5 // Tests syscall P stealing at a generation boundary.
11 "internal/trace/internal/testgen"
12 "internal/trace/tracev2"
19 func gen(t *testgen.Trace) {
22 // One goroutine is exiting with a syscall. It already
24 b0 := g.Batch(trace.ThreadID(0), 0)
25 b0.Event("GoStatus", trace.GoID(1), trace.ThreadID(0), tracev2.GoSyscall)
26 b0.Event("ProcStatus", trace.ProcID(1), tracev2.ProcIdle)
27 b0.Event("ProcStart", trace.ProcID(1), testgen.Seq(1))
28 b0.Event("GoSyscallEndBlocked")
30 // A bare M stole the goroutine's P at the generation boundary.
31 b1 := g.Batch(trace.ThreadID(1), 0)
32 b1.Event("ProcStatus", trace.ProcID(0), tracev2.ProcSyscallAbandoned)
33 b1.Event("ProcSteal", trace.ProcID(0), testgen.Seq(1), trace.ThreadID(0))