golang.org/x/exp@v0.0.0-20240506185415-9bf2ced13842/trace/testdata/generators/go122-syscall-steal-proc-simple-bare-m.go (about) 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. 4 5 // Code generated by "gen.bash" from internal/trace/v2; DO NOT EDIT. 6 7 //go:build go1.21 8 9 // Tests syscall P stealing. 10 11 package main 12 13 import ( 14 "golang.org/x/exp/trace" 15 "golang.org/x/exp/trace/internal/event/go122" 16 testgen "golang.org/x/exp/trace/internal/testgen/go122" 17 ) 18 19 func main() { 20 testgen.Main(gen) 21 } 22 23 func gen(t *testgen.Trace) { 24 g := t.Generation(1) 25 26 // One goroutine enters a syscall. 27 b0 := g.Batch(trace.ThreadID(0), 0) 28 b0.Event("ProcStatus", trace.ProcID(0), go122.ProcRunning) 29 b0.Event("GoStatus", trace.GoID(1), trace.ThreadID(0), go122.GoRunning) 30 b0.Event("GoSyscallBegin", testgen.Seq(1), testgen.NoStack) 31 b0.Event("GoSyscallEndBlocked") 32 33 // A bare M steals the goroutine's P. 34 b1 := g.Batch(trace.ThreadID(1), 0) 35 b1.Event("ProcSteal", trace.ProcID(0), testgen.Seq(2), trace.ThreadID(0)) 36 }