Debian Codegraph @

trace/testdata/generators/go122-go-create-without-running-g.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 // Regression test for an issue found in development.
10 //
11 // GoCreate events can happen on bare Ps in a variety of situations and
12 // and earlier version of the parser assumed this wasn't possible. At
13 // the time of writing, one such example is goroutines created by expiring
14 // timers.
15
16 package main
17
18 import (
19 "golang.org/x/exp/trace"
20 "golang.org/x/exp/trace/internal/testgen"
21 "golang.org/x/exp/trace/internal/tracev2"
22 "golang.org/x/exp/trace/internal/version"
23 )
24
25 func main() {
26 testgen.Main(version.Go122, gen)
27 }
28
29 func gen(t *testgen.Trace) {
30 g1 := t.Generation(1)
31
32 // A goroutine gets created on a running P, then starts running.
33 b0 := g1.Batch(trace.ThreadID(0), 0)
34 b0.Event("ProcStatus", trace.ProcID(0), tracev2.ProcRunning)
35 b0.Event("GoCreate", trace.GoID(5), testgen.NoStack, testgen.NoStack)
36 b0.Event("GoStart", trace.GoID(5), testgen.Seq(1))
37 b0.Event("GoStop", "whatever", testgen.NoStack)
38 }