go/api/next
Carlos Amedee 83df0afc4e runtime/trace: add the flight recorder
This change adds the flight recorder to the trace package.
Flight recording is a technique in which trace data is kept
in a circular buffer and can be flushed upon request. The
implementation will be added in follow-up CLs.

The flight recorder has already been implemented inside of the
golang.org/x/exp/trace package. This copies the current implementation
and modifies it to work within the runtime/trace package.

The changes include:

This adds the ability for multiple consumers (both the execution
tracer and the flight recorder) to subscribe to tracing events. This
change allows us to add multiple consumers without making major
modifications to the runtime. Future optimizations are planned
for this functionality.

This removes the use of byte readers from the process that
parses and processes the trace batches.

This modifies the flight recorder to not parse out the trace
clock frequency, since that requires knowledge of the format that's
unfortunate to encode in yet another place. Right now, the trace clock
frequency is considered stable for the lifetime of the program, so just
grab it directly from the runtime.

This change adds an in-band end-of-generation signal to the internal
implementation of runtime.ReadTrace. The internal implementation is
exported via linkname to runtime/trace, so the flight recorder can
identify exactly when a generation has ended. This signal is also useful
for ensuring that subscribers to runtime trace data always see complete
generations, by starting or stopping data streaming only at generation
boundaries.

For #63185

Change-Id: I5c15345981a6bbe9764a3d623448237e983c64ec
Reviewed-on: https://go-review.googlesource.com/c/go/+/673116
Auto-Submit: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-05-21 18:39:54 -07:00
..
43936.txt testing: add Attr 2025-05-21 15:37:35 -07:00
46771.txt mime/multipart: add helper to build content-disposition header contents 2025-03-12 16:20:01 -07:00
49580.txt io/fs: add ReadLinkFS interface 2025-02-03 08:38:43 -08:00
59928.txt testing: add Output 2025-05-13 15:43:42 -07:00
62121.txt reflect: add TypeAssert[T] 2025-05-20 12:40:33 -07:00
63185.txt runtime/trace: add the flight recorder 2025-05-21 18:39:54 -07:00
63405.txt crypto,crypto/x509: implement MessageSigner 2025-05-08 07:46:12 -07:00
63796.txt sync: add WaitGroup.Go 2025-04-04 08:19:32 -07:00
63963.txt crypto/ecdsa: add low-level encoding functions for keys 2025-05-21 14:18:13 -07:00
66365.txt log/slog: add GroupAttrs 2025-05-21 11:29:28 -07:00
67002.txt os: add Root.MkdirAll 2025-05-21 10:14:43 -07:00
67434.txt testing/synctest: add Test 2025-05-20 15:46:03 -07:00
67516.txt crypto/tls: add ConnectionState.CurveID 2025-03-13 08:19:32 -07:00
69518.txt hash: add XOF interface 2025-05-21 14:49:41 -07:00
69521.txt crypto,hash: add and implement hash.Cloner 2025-05-21 16:39:55 -07:00
70250.txt api: move go1.25 to next/70250 2025-04-03 08:07:11 -07:00
70280.txt log/slog: export Source method in Record for custom handler support 2025-05-06 03:58:07 -07:00
70780.txt unicode: add CategoryAliases, Cn, LC 2025-04-18 14:13:31 -07:00
71122.txt go/parser: deprecate parser.ParseDir 2025-02-19 11:49:13 -08:00
71920.txt crypto/tls: add GetEncryptedClientHelloKeys 2025-05-21 12:15:37 -07:00
72843.txt debug/elf: add riscv attributes definitions 2025-03-14 15:08:23 -07:00
73126.txt os: add Root.ReadFile and Root.WriteFile 2025-05-21 11:59:27 -07:00
73193.txt runtime: use cgroup CPU limit to set GOMAXPROCS 2025-05-21 10:21:55 -07:00
73205.txt go/token: add FileSet.AddExistingFiles 2025-05-19 11:26:48 -07:00
73319.txt go/ast: add PreorderStack, a variant of Inspect that builds a stack 2025-05-19 10:54:45 -07:00
73626.txt net/http: add CrossOriginProtection 2025-05-21 13:22:27 -07:00