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// Tests syscall P stealing from a goroutine and thread 6// that have been in a syscall the entire generation. 7 8package main 9 10import ( 11 "internal/trace" 12 "internal/trace/event/go122" 13 testgen "internal/trace/internal/testgen/go122" 14) 15 16func main() { 17 testgen.Main(gen) 18} 19 20func gen(t *testgen.Trace) { 21 g := t.Generation(1) 22 23 // Steal proc from a goroutine that's been blocked 24 // in a syscall the entire generation. 25 b0 := g.Batch(trace.ThreadID(0), 0) 26 b0.Event("ProcStatus", trace.ProcID(0), go122.ProcSyscallAbandoned) 27 b0.Event("ProcSteal", trace.ProcID(0), testgen.Seq(1), trace.ThreadID(1)) 28 29 // Status event for a goroutine blocked in a syscall for the entire generation. 30 bz := g.Batch(trace.NoThread, 0) 31 bz.Event("GoStatus", trace.GoID(1), trace.ThreadID(1), go122.GoSyscall) 32} 33