]> Cypherpunks repositories - gostls13.git/commit
internal/trace/v2: redefine NoTask and add BackgroundTask
authorMichael Anthony Knyszek <mknyszek@google.com>
Fri, 17 Nov 2023 17:56:27 +0000 (17:56 +0000)
committerMichael Knyszek <mknyszek@google.com>
Tue, 21 Nov 2023 21:28:43 +0000 (21:28 +0000)
commit5dde69fd404cb6d0de89b0109a7f7b03e44c26f7
treeb1b59a60a6978d5e4a82e0befdd8c351731ad80b
parentd1dcffdb4a40f8ea89d9e57744142f9805b64840
internal/trace/v2: redefine NoTask and add BackgroundTask

The v2 trace parser currently handles task inheritance and region task
association incorrectly. It assumes that a TaskID of 0 means that there
is no task. However, this is only true for task events. A TaskID of 0
means that a region gets assigned to the "background task." The parser
currently has no concept of a "background task."

Fix this by defining the background task as task ID 0 and redefining
NoTask to ^uint64(0). This aligns the TaskID values more closely with
other IDs in the parser and also enables disambiguating these two cases.

For #60773.
For #63960.

Change-Id: I09c8217b33b87c8f8f8ea3b0203ed83fd3b61e11
Reviewed-on: https://go-review.googlesource.com/c/go/+/543019
Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com>
TryBot-Bypass: Michael Knyszek <mknyszek@google.com>
src/internal/trace/goroutinesv2.go
src/internal/trace/v2/event.go
src/internal/trace/v2/order.go
src/internal/trace/v2/testdata/generators/go122-task-across-generations.go
src/internal/trace/v2/testtrace/validation.go
src/internal/trace/v2/trace_test.go