runtime: fix trace EvGoStop Gosched reason to match function

Currently the stop reason for runtime.Gosched is labeled
"runtime.GoSched" which doesn't actually match the function name. Fix
the label to match the function name.

This change doesn't regenerate the internal/trace/v2 tests, because
regenerating the tests breaks summarization tests in internal/trace that
rely on very specific details in the example traces that aren't
guaranteed. Also, go122-gc-trace.test isn't generated at all, as it
turns out. I'll fix this all up in a follow-up CL. For now, just replace
runtime.GoSched with runtime.Gosched in the traces so we don't have a
problem later if a test wants to look for that string.

This change does regenerate the cmd/trace/v2 test, but it turns out the
cmd/trace/v2 tests are way too strict about network unblock events, and
3 usually pop up instead of 1 or 2, which is what the test expects.
AFAICT this looks plausible to me, so just lift the restriction on
"up to 2" events entirely.

Change-Id: Id7350132be19119c743c259f2f5250903bf41a04
Reviewed-on: https://go-review.googlesource.com/c/go/+/552275
TryBot-Bypass: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
This commit is contained in:
Michael Anthony Knyszek 2023-12-21 20:26:38 +00:00 committed by Michael Knyszek
parent d864eac249
commit 287f791845
7 changed files with 4553 additions and 4280 deletions

View file

@ -167,8 +167,8 @@ func checkNetworkUnblock(t *testing.T, data format.Data) {
if netBlockEv == nil {
t.Error("failed to find a network unblock")
}
if count == 0 || count > 2 {
t.Errorf("found too many network block events: want 1 or 2, found %d", count)
if count == 0 {
t.Errorf("found zero network block events, want at least one")
}
// TODO(mknyszek): Check for the flow of this event to some slice event of a goroutine running.
}

File diff suppressed because it is too large Load diff

View file

@ -896,7 +896,7 @@ String id=18
String id=19
data="sleep"
String id=20
data="runtime.GoSched"
data="runtime.Gosched"
String id=21
data="start trace"
String id=22

View file

@ -220,7 +220,7 @@ String id=18
String id=19
data="sleep"
String id=20
data="runtime.GoSched"
data="runtime.Gosched"
String id=21
data="start trace"
String id=22

View file

@ -4086,7 +4086,7 @@ String id=18
String id=19
data="sleep"
String id=20
data="runtime.GoSched"
data="runtime.Gosched"
String id=21
data="GC mark termination"
String id=22

View file

@ -213,7 +213,7 @@ func TestTraceFutileWakeup(t *testing.T) {
// Check to make sure that no goroutine in the "special" trace region
// ends up blocking, unblocking, then immediately blocking again.
//
// The goroutines are careful to call runtime.GoSched in between blocking,
// The goroutines are careful to call runtime.Gosched in between blocking,
// so there should never be a clean block/unblock on the goroutine unless
// the runtime was generating extraneous events.
const (

View file

@ -133,7 +133,7 @@ const (
var traceGoStopReasonStrings = [...]string{
traceGoStopGeneric: "unspecified",
traceGoStopGoSched: "runtime.GoSched",
traceGoStopGoSched: "runtime.Gosched",
traceGoStopPreempted: "preempted",
}