]> Cypherpunks repositories - gostls13.git/commit
runtime,internal/trace: emit clock snapshots at the start of trace generations
authorFelix Geisendörfer <felix.geisendoerfer@datadoghq.com>
Fri, 28 Feb 2025 15:07:16 +0000 (16:07 +0100)
committerGopher Robot <gobot@golang.org>
Wed, 21 May 2025 15:20:34 +0000 (08:20 -0700)
commit112c23612f5fdfb776d8f338479e1dc374ee6f1b
tree5787aa6e4da5ece1265e977e15e3a1d85e83f240
parent0d7dc6842b3de170fcc8c72aa4380269b8f21f80
runtime,internal/trace: emit clock snapshots at the start of trace generations

Replace the per-generation EvEventBatch containing a lone EvFrequency
event with a per-generation EvEventBatch containing a EvSync header
followed by an EvFrequency and EvClockSnapshot event.

The new EvClockSnapshot event contains trace, mono and wall clock
snapshots taken in close time proximity. Ignoring minor resolution
differences, the trace and mono clock are the same on linux, but not on
windows (which still uses a TSC based trace clock).

Emit the new sync batch at the very beginning of every new generation
rather than the end to be in harmony with the internal/trace reader
which emits a sync event at the beginning of every generation as well
and guarantees monotonically increasing event timestamps.

Bump the version of the trace file format to 1.25 since this change is
not backwards compatible.

Update the internal/trace reader implementation to decode the new
events, but do not expose them to the public reader API yet. This is
done in the next CL.

For #69869

Change-Id: I5bfedccdd23dc0adaf2401ec0970cbcc32363393
Reviewed-on: https://go-review.googlesource.com/c/go/+/653575
Reviewed-by: David Chase <drchase@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
src/internal/trace/base.go
src/internal/trace/batch.go
src/internal/trace/generation.go
src/internal/trace/reader.go
src/internal/trace/tracev2/events.go
src/internal/trace/version/version.go
src/runtime/trace.go
src/runtime/tracetime.go