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.
11 "internal/trace/v2/event/go122"
12 testgen "internal/trace/v2/internal/testgen/go122"
19 func gen(t *testgen.Trace) {
22 // One goroutine enters a syscall, grabs a P, and starts running.
23 b0 := g.Batch(trace.ThreadID(0), 0)
24 b0.Event("ProcStatus", trace.ProcID(1), go122.ProcIdle)
25 b0.Event("ProcStatus", trace.ProcID(0), go122.ProcRunning)
26 b0.Event("GoStatus", trace.GoID(1), trace.ThreadID(0), go122.GoRunning)
27 b0.Event("GoSyscallBegin", testgen.NoStack)
28 b0.Event("ProcStart", trace.ProcID(1), testgen.Seq(1))
29 b0.Event("GoSyscallEndBlocked")
31 // A bare M steals the goroutine's P.
32 b1 := g.Batch(trace.ThreadID(1), 0)
33 b1.Event("ProcSteal", trace.ProcID(0), testgen.Seq(1), trace.ThreadID(0))