Skip to content

Commit f22d37d

Browse files
prattmicgopherbot
authored andcommitted
runtime/internal/testprog: log initial SchedMetrics GOMAXPROCS
For #76613. Change-Id: I6a6a636ccf28676b9cd1f820bbe42c2f3e974fee Reviewed-on: https://go-review.googlesource.com/c/go/+/725660 Reviewed-by: Michael Knyszek <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Auto-Submit: Michael Pratt <[email protected]>
1 parent 8b5db48 commit f22d37d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/runtime/testdata/testprog/schedmetrics.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ func SchedMetrics() {
7272
}
7373
}
7474

75+
initialGMP := runtime.GOMAXPROCS(-1)
76+
logf("Initial GOMAXPROCS=%d", initialGMP)
77+
7578
// generalSlack is the amount of goroutines we allow ourselves to be
7679
// off by in any given category, either due to background system
7780
// goroutines. This excludes GC goroutines.
@@ -80,7 +83,7 @@ func SchedMetrics() {
8083
// waitingSlack is the max number of blocked goroutines controlled
8184
// by the runtime that we'll allow for. This includes GC goroutines
8285
// as well as finalizer and cleanup goroutines.
83-
waitingSlack := generalSlack + uint64(2*runtime.GOMAXPROCS(-1))
86+
waitingSlack := generalSlack + uint64(2*initialGMP)
8487

8588
// threadsSlack is the maximum number of threads left over
8689
// from the runtime (sysmon, the template thread, etc.)

0 commit comments

Comments
 (0)