aboutsummaryrefslogtreecommitdiff
path: root/src/internal/trace
AgeCommit message (Collapse)Author
2025-07-07internal/trace: only test for sync preemption if async preemption is offMichael Anthony Knyszek
Currently, the test change made for the fix to #68090 is flaky. This is because the sync-point-only goroutine that we expect to be sync preempted might only ever get async preempted in some circumstances. This change adds a variant to all trace tests to run with asyncpreemptoff=1, and the stacks test, the flaky one, only actually checks for the sync-point in the trace when async preemption is disabled. Fixes #74417. Change-Id: Ib6341bbc26921574b8f0fff6dd521ce83f85499c Reviewed-on: https://go-review.googlesource.com/c/go/+/686055 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-06-27runtime: account for missing frame pointer in preambleMichael Anthony Knyszek
If a goroutine is synchronously preempted, then taking a frame-pointer-based stack trace at that preemption will skip PC of the caller of the function which called into morestack. This happens because the frame pointer is pushed to the stack after the preamble, leaving the stack in an odd state for frame pointer unwinding. Deal with this by marking a goroutine as synchronously preempted and using that signal to load the missing PC from the stack. On LR platforms this is available in gp.sched.lr. On non-LR platforms like x86, it's at gp.sched.sp, because there are no args, no locals, and no frame pointer pushed to the SP yet. For #68090. Change-Id: I73a1206d8b84eecb8a96dbe727195da30088f288 Reviewed-on: https://go-review.googlesource.com/c/go/+/684435 Reviewed-by: Cherry Mui <cherryyz@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Nick Ripley <nick.ripley@datadoghq.com>
2025-06-23internal/trace: improve gc-stress testMichael Anthony Knyszek
The gc-stress test is useful for trying to exercise GC-related trace events by producing a lot of them in many different situations. Unfortunately this test is flaky, because allocating in a loop can easily out-run the GC when it's trying to preempt the allocating goroutine. It's been a long standing problem that a program that allocates in a loop can outrun a GC. The problem isn't the GC persay, it's consistently correlated with a high STW time (likely a high 'stopping' time, not a 'stopped' time), suggesting that in the window of time when the garbage collector is trying to stop all goroutines, they continue to allocate. This should probably be fixed in general, but for now, let's focus on this flaky test. This CL changes the gc-stress test to (1) set a memory limit and (2) do more work in between allocations. (2) is really what makes things less flaky, but (2) unfortunately also means the GC is less exercised. That's where (1) comes in. By setting a low memory limit, we increase GC activity (in particular, assist activity). The memory limit also helps prevent the heap from totally blowing up due to the heap goal inflating from floating garbage, but it's not perfect. After this change, under stress2, this test exceeds a heap size of 500 MiB only 1 in 5000 runs on my 64-vCPU VM. Before this change, it got that big about 1/4th of the time. Fixes #74052. Change-Id: I49233c914c8b65b1d593d3953891fddda6685aec Reviewed-on: https://go-review.googlesource.com/c/go/+/683515 Reviewed-by: Carlos Amedee <carlos@golang.org> Auto-Submit: Michael Knyszek <mknyszek@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-06-16internal/trace: make Value follow reflect conventionsMichael Anthony Knyszek
A previous change renamed Value.Uint64 to Value.ToUint64 to accomodate string values. The method for a string value is then Value.ToString, while the method for a debug string (for example, for fmt) is just called String, as per fmt.Stringer. This change follows a request from Dominik Honnef, maintainer of gotraceui, to make Value follow the conventions of the reflect package. The Value type there has a method String which fulfills both purposes: getting the string for a String Value, and as fmt.Stringer. It's not exactly pretty, but it does make sense to just stick to convention. Change-Id: I55b364be88088d2121527bffc833ef03dbdb9764 Reviewed-on: https://go-review.googlesource.com/c/go/+/680978 Reviewed-by: Florian Lehner <lehner.florian86@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Carlos Amedee <carlos@golang.org>
2025-06-12internal/trace: end test programs with SIGQUITMichael Anthony Knyszek
This change switches from using testenv.Command to testenv.CommandContext which is a little bit friendlier. It also switches away from using 'go run' to 'go build' and running the resulting binary explicitly. This helps eliminate any questions about signal handling and propagation. For #72740. Change-Id: Ife8010da89a7bc439e061fe0c9c6b1f5620d90f1 Reviewed-on: https://go-review.googlesource.com/c/go/+/680977 Reviewed-by: Carlos Amedee <carlos@golang.org> TryBot-Bypass: Michael Knyszek <mknyszek@google.com>
2025-06-10internal/trace: pass GOTRACEBACK=crash to testprogsMichael Anthony Knyszek
The failures in #70310 are hard to decipher. The cases where the lock is being held either don't really make sense (the STW failures) or the goroutine that fails is 'running on another thread' and we don't get a stack trace. In fact, such a goroutine exists even in the STW cases. Since reproducing this is going to be hard (very few failures over a 2 year span) let's set GOTRACEBACK=crash for these testprogs so next time it happens we can see why. For #70310. Change-Id: I81a780aa82b173d42973f06911cb243f33352be1 Reviewed-on: https://go-review.googlesource.com/c/go/+/680476 Reviewed-by: Michael Pratt <mpratt@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Carlos Amedee <carlos@golang.org>
2025-05-30internal/trace: expose the go version read by the readerCarlos Amedee
This change adds a function to expose the version set by the trace reader after reading the trace header (in tests). The trace validator needs to be able to determine what version of the trace it needs to validate against. Clock snapshot checks have been disabled for Windows and WASM. For #63185 Change-Id: Ia3d63e6ed7a5ecd87e63292b84cc417d982aaa5a Reviewed-on: https://go-review.googlesource.com/c/go/+/677695 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Carlos Amedee <carlos@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-05-21runtime/trace: add the flight recorderCarlos Amedee
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-21internal/trace: skip clock snapshot checks on Windows in stress modeMichael Anthony Knyszek
Windows' monotonic and wall clock granularity is just too coarse to get reasonable values out of stress mode, which is creating new trace generations constantly. Fixes #73813. Change-Id: Id9cb2fed9775ce8d78a736d0164daa7bf45075e0 Reviewed-on: https://go-review.googlesource.com/c/go/+/675096 Reviewed-by: Felix Geisendörfer <felix.geisendoerfer@datadoghq.com> Reviewed-by: Roland Shoemaker <roland@golang.org> Auto-Submit: Michael Knyszek <mknyszek@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-05-21internal/trace: add generator tests for sync eventsFelix Geisendörfer
Add generator tests that verify the timestamps for the sync events emitted in the go1.25 trace format and earlier versions. Add the ability to configure the properties of the per-generation sync batches in testgen. Also refactor testgen to produce more realistic timestamps by keeping track of lastTs and using it for structural batches that don't have their own timestamps. Otherwise they default to zero which means the minTs of the generation can't be controlled. For #69869 Change-Id: I92a49b8281bc4169b63e13c030c1de7720cd6f26 Reviewed-on: https://go-review.googlesource.com/c/go/+/653876 Auto-Submit: Michael Knyszek <mknyszek@google.com> Reviewed-by: David Chase <drchase@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
2025-05-21internal/trace/internal/testgen: make generated trace version configurableFelix Geisendörfer
Replace hard coded references to version.Go122 with the trace version passed to NewTrace. This allows writing testgen tests for newer trace versions. For #69869 Change-Id: Id25350cea1c397a09ca23465526ff259e34a4752 Reviewed-on: https://go-review.googlesource.com/c/go/+/653875 Auto-Submit: Michael Knyszek <mknyszek@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-05-21internal/trace: add a validator test for the new clock snapshotsFelix Geisendörfer
Check that the clock snapshots, when expected to be present, are non-zero and monotonically increasing. This required some refactoring to make the validator aware of the version of the trace it is validating. Change-Id: I04c4dd10fe6975cbac12bb0ddaebcec3a5284e7b Reviewed-on: https://go-review.googlesource.com/c/go/+/669715 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> Reviewed-by: David Chase <drchase@google.com>
2025-05-21internal/trace: expose clock snapshot timestamps on sync eventFelix Geisendörfer
Add ClockSnapshot field to the Sync event type and populate it with the information from the new EvClockSnapshot event when available. For #69869 Change-Id: I3b24b5bfa15cc7a7dba270f5e6bf189adb096840 Reviewed-on: https://go-review.googlesource.com/c/go/+/653576 Reviewed-by: Michael Knyszek <mknyszek@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com> Auto-Submit: Michael Knyszek <mknyszek@google.com>
2025-05-21runtime,internal/trace: emit clock snapshots at the start of trace generationsFelix Geisendörfer
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>
2025-02-14internal/trace: emit sync event before deferred spilled errorMichael Anthony Knyszek
CL 648315 and CL 648195 fixed #71615 in the case where we fail to read the next generation by emitting an extra sync event before returning an error. But, it's possible we failed to even read the next spilled batch when we read the first generation, and have been carrying the error from trying to read a spilled batch since the last generation. In this case, we don't emit a final sync event, meaning that there are still some cases where #71615 happens. This change emits the final sync event in this corner case. I believe this is the final corner case. I could previously reproduce the issue by running the test under stress2, but I can no longer reproduce any failures after this change. Fixes #71615, for real this time. Change-Id: I10688a3c0e4b8327a95f31add365338c77c091ab Reviewed-on: https://go-review.googlesource.com/c/go/+/649259 Reviewed-by: Cherry Mui <cherryyz@google.com> Auto-Submit: Michael Knyszek <mknyszek@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-02-11internal/trace/tracev2: add guide for trace experimentsMichael Anthony Knyszek
Change-Id: I6fb354a57f3e73bd6589570868c7d68369adcf3c Reviewed-on: https://go-review.googlesource.com/c/go/+/645136 Reviewed-by: Michael Pratt <mpratt@google.com> Auto-Submit: Michael Knyszek <mknyszek@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-02-11internal/trace: interpret string ID arguments for experimental eventsMichael Anthony Knyszek
Currently one of the reasons experimental events are tricky to use is because: - There's no way to take advantage of the existing infrastructure, like strings and stacks, and - There's no way to attach arbitrary data to an event (except through strings, possibly). Fix this by abstracting away the raw arguments in an ExperimentalEvent and requiring access to the arguments via a new method, ArgValue. This returns a Value, which gives us an opportunity to construct a typed value for the raw argument dynamically, and a way to access existing tables. The type of the argument is deduced from conventions for the argument's name. This seems more than sufficient for experimental events. To make this work, we also need to add a "string" variant to the Value type. This may be a little confusing since they're primarily used for metrics, but one could imagine other scenarios in which this is useful, such as including build information in the trace as a metric, so I think this is fine. This change also updates the Value API to accomodate a String method for use with things that expect a fmt.Stringer, which means renaming the value assertion methods to have a "To" prefix. Change-Id: I43a2334f6cd306122c5b94641a6252ca4258b39f Reviewed-on: https://go-review.googlesource.com/c/go/+/645135 Reviewed-by: Michael Pratt <mpratt@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Michael Knyszek <mknyszek@google.com>
2025-02-11internal/trace: move fake P IDs to internal/trace/traceviewerMichael Anthony Knyszek
These fake P IDs really only belong to the traceviewer. Change-Id: I7976beb5750f1efca85e28975074a8c570a9c959 Reviewed-on: https://go-review.googlesource.com/c/go/+/644876 Reviewed-by: Michael Pratt <mpratt@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Michael Knyszek <mknyszek@google.com>
2025-02-11internal/trace: clean up parser.goMichael Anthony Knyszek
parser.go is an old file that contains trace v1 definitions and a second equivalent definition for stack frames. These are redundant and useless. Delete these definitions and rename the file to fakep.go, which describes the only thing left in this file, a bunch of fake P IDs used by the trace viewer. We should consider moving the fake P definitions elsewhere, too. Change-Id: Ifd0768bd73c39009069445afe0155f1e352f00c3 Reviewed-on: https://go-review.googlesource.com/c/go/+/644875 Reviewed-by: Michael Pratt <mpratt@google.com> Auto-Submit: Michael Knyszek <mknyszek@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-02-11runtime: use internal/trace/tracev2 definitionsMichael Anthony Knyszek
This change deduplicates trace wire format definitions between the runtime and the trace parser by making the internal/trace/tracev2 package the source of truth. Change-Id: Ia0721d3484a80417e40ac473ec32870bee73df09 Reviewed-on: https://go-review.googlesource.com/c/go/+/644221 Auto-Submit: Michael Knyszek <mknyszek@google.com> Reviewed-by: Michael Pratt <mpratt@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-02-11internal/trace: move maxArgs into tracev2 and validate specsMichael Anthony Knyszek
This change moves maxArgs to tracev2 and renames it MaxTimedEventArgs. It also updates the tests to make sure the specs conform to this requirement. Change-Id: I7b0c888a4dfd83306a470a4c9b0f9e44fe2e7818 Reviewed-on: https://go-review.googlesource.com/c/go/+/646016 TryBot-Bypass: Michael Knyszek <mknyszek@google.com> Reviewed-by: Michael Pratt <mpratt@google.com> Auto-Submit: Michael Knyszek <mknyszek@google.com>
2025-02-11internal/trace/tracev2: add test to validate spec invariantsMichael Anthony Knyszek
This change adds a test to help guide people adding experiments to this package by validating that the spec is written correctly. Also, makes some minor tweaks to the package in order to get the tests to pass. Change-Id: I3daa420c5a9ec3ea536415c8e5d06f41666a9566 Reviewed-on: https://go-review.googlesource.com/c/go/+/646015 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Pratt <mpratt@google.com> Auto-Submit: Michael Knyszek <mknyszek@google.com>
2025-02-11internal/trace: increment sync counter before final Sync on errorMichael Anthony Knyszek
CL 648195 was supposed to have fixed #71615, but it didn't include an update to r.syncs. I can confirm this CL fixes the issue even when running the test many times in a row. Fixes #71615. Change-Id: I97db3d639dc5bc8648a191696f90b0e5087307c8 Reviewed-on: https://go-review.googlesource.com/c/go/+/648315 Auto-Submit: Michael Knyszek <mknyszek@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> TryBot-Bypass: Michael Knyszek <mknyszek@google.com>
2025-02-10internal/trace: emit a Sync event even if the next generation is brokenMichael Anthony Knyszek
Since CL 644215 each Sync event now represents the coming generation, with a final Sync event emitted even when there's nothing ahead. This change however failed to emit a Sync event at the end of a completely valid generation when the next generation was invalid, causing the runtime test TestCrashWhileTracing to start failing. Fix this by emitting a final Sync event even when the next generation is broken. We hold onto the error in parsing the next generation and emit it after that final Sync event. (Should these "final" Sync events distinguish themselves in some way?) Fixes #71615. Change-Id: I1f8abee5abaa39e1219e6fa05e9f82f1478db4c9 Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest Reviewed-on: https://go-review.googlesource.com/c/go/+/648195 Auto-Submit: Michael Knyszek <mknyszek@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
2025-02-10internal/trace: merge event and tracev2 packagesMichael Anthony Knyszek
These two packages were historically separate in an attempt to provide a unified description of trace v1 and trace v2 formats. In practice this turned out to be pointless, since it made more sense to keep the trace v1 parser in a self-contained bubble with a converter to v2. Future trace wire format migrations should probably just follow the same general strategy, if there's a substantial change. (Minor changes can be handled more organically.) Change-Id: Ic765df62065fe53cfae59b505297527c3fa42dfb Reviewed-on: https://go-review.googlesource.com/c/go/+/645395 Auto-Submit: Michael Knyszek <mknyszek@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Pratt <mpratt@google.com>
2025-02-10internal/trace/internal/testgen: force trace version selectionMichael Anthony Knyszek
Currently testgen only generates Go 1.22 tests. Allow generating tests for different versions, especially now that we've tightened up which events can be emitted by different versions. Change-Id: Ia64309c6934f34eace03b3229d05fca5acfc7366 Reviewed-on: https://go-review.googlesource.com/c/go/+/644220 Reviewed-by: Michael Pratt <mpratt@google.com> Auto-Submit: Michael Knyszek <mknyszek@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-02-10internal/trace: be stricter about allowed events in v2 trace versionsMichael Anthony Knyszek
Currently all v2 trace versions, Go 1.22 and Go 1.23, share a full set of specs. This is mostly OK, but it means quite a few events will be accepted for 1.22 traces that should be rejected. This change fixes that by limiting which event specs are returned by version.Version.Specs for Go 1.22. While we're here, let's be stricter about event names too, and move tracev2.EventString to be a method on the version, so we can be more precise. An intended consequence of this move is that tracev2 no longer depends on fmt, since we will want the runtime to depend on tracev2 in the near future. Change-Id: If7285460c8ba59ab73da00993b7b12e61cdfe6a9 Reviewed-on: https://go-review.googlesource.com/c/go/+/644219 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Michael Knyszek <mknyszek@google.com> Reviewed-by: Michael Pratt <mpratt@google.com>
2025-02-10internal/trace: rename go122 to tracev2Michael Anthony Knyszek
This change follows up from the previous one which renamed oldtrace to tracev1, defining everything Go 1.22+ as trace v2. This change also re-maps some packages in preparation for sharing with other parts of the standard library, like the runtime. It also cleans up some other uses of 'go122' that are just a bit misleading. The mappings are as follows: - internal/trace/event -> internal/trace/tracev2/event - internal/trace/event/go122 -> internal/trace/tracev2 - internal/trace/internal/testgen/go122 -> internal/trace/internal/testgen The CL updates all import paths and runs gofmt -w -s on the entire subdirectory. Change-Id: I35476c679a96d4eafad6b94bac5f88aa7b085d2f Reviewed-on: https://go-review.googlesource.com/c/go/+/644218 Auto-Submit: Michael Knyszek <mknyszek@google.com> Reviewed-by: Michael Pratt <mpratt@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-02-07internal/trace: rename "oldtrace" to trace v1Michael Anthony Knyszek
This is part of a refactoring to better distinguish trace wire format versions. Even though details may change between Go versions and they might be backwards-incompatible, the trace format still broadly has two wire formats: v1 and v2. A follow-up change will rename go122 to v2 to make this more consistent. Change-Id: If4fe1c82d8aeabc8baa05f525e08a9e7d469a5c7 Reviewed-on: https://go-review.googlesource.com/c/go/+/644217 Auto-Submit: Michael Knyszek <mknyszek@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Pratt <mpratt@google.com>
2025-02-07internal/trace: move SchedReqs out of events packageMichael Anthony Knyszek
It's only used by order.go; there's no reason for it to be in a shared package. Change-Id: If99df075089e6f6e37a78b12e64a1b81a556331c Reviewed-on: https://go-review.googlesource.com/c/go/+/644216 Auto-Submit: Michael Knyszek <mknyszek@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Pratt <mpratt@google.com>
2025-02-07internal/trace: refactor how experimental batches are exposedMichael Anthony Knyszek
This change modifies how per-generation experimental batches are exposed. Rather than expose them on the ExperimentalEvent, it exposes it as part of the Sync event, so it's clear to the caller when the information becomes relevant and when it should be parsed. This change also adds a field to each ExperimentalEvent indicating which experiment the event is a part of. Because this information needs to appear *before* a generation is observed, we now ensure there is a sync event both before and after each generation. This means the final sync event is now a special case; previously we would only emit a sync event after each generation. This change is based on feedback from Austin Clements on the experimental events functionality. For #62627. Change-Id: I48b0fe12b22abb7ac8820a9e73447bfed8419856 Reviewed-on: https://go-review.googlesource.com/c/go/+/644215 Auto-Submit: Michael Knyszek <mknyszek@google.com> Reviewed-by: Michael Pratt <mpratt@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2025-02-05internal/trace: skip TestTraceCgoCallback on freebsd-amd64-race buildersDmitri Shuralyov
For #71556. Change-Id: I754f113bfdad244d0e978cf559bf45f2f4d7bf06 Reviewed-on: https://go-review.googlesource.com/c/go/+/646396 Reviewed-by: Michael Knyszek <mknyszek@google.com> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Bypass: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2025-02-03all: use slices.Contains to simplify codecuishuang
Change-Id: I9ef075bbb0e3c65f3c2a9d49e599ef50b18aa9be Reviewed-on: https://go-review.googlesource.com/c/go/+/639535 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-11-21all: fix some function names and typos in commentcuishuang
Change-Id: I07e7c8eaa5bd4bac0d576b2f2f4cd3f81b0b77a4 Reviewed-on: https://go-review.googlesource.com/c/go/+/630055 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Commit-Queue: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Russ Cox <rsc@golang.org> Auto-Submit: Ian Lance Taylor <iant@google.com>
2024-09-23cmd/trace,internal/trace,runtime: refactor to access frames via range over funcFelix Geisendörfer
Change-Id: Id0be0eb35ae8560bd5338ec296a086aaf4617db0 Reviewed-on: https://go-review.googlesource.com/c/go/+/608856 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
2024-09-23internal/trace: refactor Stack.Frames to return iter.SeqFelix Geisendörfer
The Frames function is almost an iter.Seq, except for its bool return value. Since none of the callers in the Go tree rely on the bool, we can remove it. However, doing so might still obscure the intended usage as an iterator. This refactor changes the API to return iter.Seq, making the intended usage explicit. Refactoring the existing callers to take advantage of the new interface will be done in a follow-up CL. Change-Id: I03e4d6d762910e418cc37d59a6c519eb7f39b3b0 Reviewed-on: https://go-review.googlesource.com/c/go/+/608855 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
2024-08-20src: fix typosAlexander Cyon
Fix typos in ~30 files Change-Id: Ie433aea01e7d15944c1e9e103691784876d5c1f9 GitHub-Last-Rev: bbaeb3d1f88a5fa6bbb69607b1bd075f496a7894 GitHub-Pull-Request: golang/go#68964 Reviewed-on: https://go-review.googlesource.com/c/go/+/606955 Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-08-19all: remove duplicated words in commentsOleksandr Redko
Change-Id: Id991ec0826a4e2857f00330b4b7ff2b71907b789 Reviewed-on: https://go-review.googlesource.com/c/go/+/606615 Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Robert Griesemer <gri@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Robert Griesemer <gri@google.com> Commit-Queue: Ian Lance Taylor <iant@google.com>
2024-07-29internal/trace: reduce event size by packing goroutine statusesNick Ripley
The trace parser was using an otherwise-unused event argument to hold an extra goroutine state argument for the GoStatus & GoStatusStack events. This is needed because the execution tracer just records the "after" for state transitions, but we want to have both the "before" and "after" states available in the StateTransition info for the parsed event. When GoStatusStack was added, the size of the argument array was increased to still have room for the extra status. However, statuses are currently only 1 byte, and the status argument is 8 bytes, so there is plenty of room to pack the "before" and "after" statuses in a single argument. Do that instead to avoid the need for an extra argument. Change-Id: I6886eeb14fb8e5e046b6afcc5b19e04218bcacd4 Reviewed-on: https://go-review.googlesource.com/c/go/+/601455 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> 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>
2024-07-24internal/trace/event: fix typo in commentKoichi Shiraishi
Change-Id: Ia191daf8e748f17dcea6038166504fb50e7ddb0d Reviewed-on: https://go-review.googlesource.com/c/go/+/589535 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> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2024-07-23cmd/trace: merge testdata debugging tools into the trace toolMichael Anthony Knyszek
Currently internal/trace/testdata contains three debugging tools which were written early in the trace rewrite for debugging. Two of these are completely redundant with go tool trace -d=1 and go tool trace -d=2. The only remaining one landed in the last cycle and could easily also be another debug mode. This change thus merges gotraceeventstats into go tool trace as a new debug mode, and updates the debug mode flag (-d) to accept a string, giving each mode a more descriptive name. Change-Id: I170f30440691b81de846b4e247deb3d0982fc205 Reviewed-on: https://go-review.googlesource.com/c/go/+/593975 Reviewed-by: Michael Pratt <mpratt@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Michael Knyszek <mknyszek@google.com>
2024-07-22internal/trace: make Reader output deterministicRhys Hiltner
Multiple Ms can offer Events with identical timestamps. The Reader edits those so the timestamps are strictly increasing, but it needs a way to break the tie. Use something deterministic (such as the order of the batches), rather than map iteration order. Updates #68277 Change-Id: I4a1f70c1669ce1c9b52d09e2bc99acbc831ef9a4 Reviewed-on: https://go-review.googlesource.com/c/go/+/596355 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Rhys Hiltner <rhys.hiltner@gmail.com> Reviewed-by: Carlos Amedee <carlos@golang.org> Reviewed-by: Than McIntosh <thanm@google.com> Reviewed-by: Michael Pratt <mpratt@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
2024-06-03all: make function comments match function namescuishuang
Change-Id: Ideb9ef00e7bc660b005fc080973fd9f3d36c5a1f Reviewed-on: https://go-review.googlesource.com/c/go/+/589536 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com> Run-TryBot: shuang cui <imcusg@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
2024-05-30internal/trace: actually add experimental data to mapMichael Pratt
addExperimentalData was missing actually placing the data into the map, leaving ExperimentalEvent.Data always nil. Change-Id: I1715ab11eb7cfcdb982b56be28378521a357ca2d Reviewed-on: https://go-review.googlesource.com/c/go/+/588955 Reviewed-by: Carlos Amedee <carlos@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-30internal/trace: fix off-by-one error in arguments for exp eventsMichael Anthony Knyszek
There's an off-by-one error in computing the Args field for experimental events, resulting in confusing output. This wasn't caught because no test actually checks to make sure the experimental arguments make sense yet. Change-Id: I339677a80bee6319407fced20d5e0f9c2fd235b3 Reviewed-on: https://go-review.googlesource.com/c/go/+/589055 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Carlos Amedee <carlos@golang.org> Auto-Submit: Michael Knyszek <mknyszek@google.com> Reviewed-by: Michael Pratt <mpratt@google.com>
2024-05-24internal/trace: remove last references to internal/trace/v2Michael Anthony Knyszek
This change removes the last few references to internal/trace/v2. Notably, it shows up in the generators' imports, so they'll fail to run currently. Change-Id: Ibc5a9c1844634ea7620558e270ca3db9921ba56e Reviewed-on: https://go-review.googlesource.com/c/go/+/587930 Auto-Submit: Michael Knyszek <mknyszek@google.com> Reviewed-by: Carlos Amedee <carlos@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-23all: change from sort functions to slices functions where feasibleIan Lance Taylor
Doing this because the slices functions are slightly faster and slightly easier to use. It also removes one dependency layer. This CL does not change packages that are used during bootstrap, as the bootstrap compiler does not have the required slices functions. It does not change the go/scanner package because the ErrorList Len, Swap, and Less methods are part of the Go 1 API. Change-Id: If52899be791c829198e11d2408727720b91ebe8a Reviewed-on: https://go-review.googlesource.com/c/go/+/587655 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Commit-Queue: Ian Lance Taylor <iant@google.com> Reviewed-by: Damien Neil <dneil@google.com>
2024-05-22internal/trace: fix up debug commandsMichael Anthony Knyszek
They were still referencing the old internal/trace/v2 packages, and gotraceeventstats had an extra layer of cmd directory (not sure why, maybe it was always like that). Change-Id: Ieba48074ff36ea86c467168568751177d80db31d Reviewed-on: https://go-review.googlesource.com/c/go/+/586998 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Pratt <mpratt@google.com> Auto-Submit: Michael Knyszek <mknyszek@google.com>
2024-05-17internal/trace: move v2 tracer into trace directoryCarlos Amedee
This change moves the v2 tracer into the trace directory. Updates #67367 Change-Id: I3657b4227002cb00fdf29c797434800ea796715e Reviewed-on: https://go-review.googlesource.com/c/go/+/584538 Reviewed-by: Michael Knyszek <mknyszek@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-05-17internal/trace: remove remnanats of v1 tracerCarlos Amedee
This change removes unused parts of the v1 tracer in preperation of the move of the v2 tracer into the trace package. Updates #67367 Change-Id: I3e53a8afdef72dc90c2d5b514380d1077d284bc7 Reviewed-on: https://go-review.googlesource.com/c/go/+/584537 Reviewed-by: Michael Knyszek <mknyszek@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>