Debian Codegraph @

trace/testdata/generators/go122-syscall-steal-proc-sitting-in-syscall.go

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