diff options
author | Michael Knyszek <mknyszek@google.com> | 2021-10-01 15:07:45 -0400 |
---|---|---|
committer | Michael Knyszek <mknyszek@google.com> | 2021-10-29 18:35:59 +0000 |
commit | 5ec2427357f4917d0aad40cffddeea73e580129e (patch) | |
tree | a63abe5328886352bdaf6201ab0ae850f0721e03 /src/runtime/mgc.go | |
parent | 9da64156a62e4661fb5b0e64a2f196f253ce0dc5 (diff) | |
download | go-5ec2427357f4917d0aad40cffddeea73e580129e.tar.gz go-5ec2427357f4917d0aad40cffddeea73e580129e.zip |
runtime: pass nanotime and gomaxprocs into startCycle and endCycle explicitly
This is to facilitate testing of the pacer, since otherwise this is
accessing global state, which is impossible to stub out properly.
For #44167.
Change-Id: I52c3b51fc0ffff38e3bbe534bd66e5761c0003a8
Reviewed-on: https://go-review.googlesource.com/c/go/+/353353
Trust: Michael Knyszek <mknyszek@google.com>
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Diffstat (limited to 'src/runtime/mgc.go')
-rw-r--r-- | src/runtime/mgc.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/runtime/mgc.go b/src/runtime/mgc.go index cf53585dcd..03711a9617 100644 --- a/src/runtime/mgc.go +++ b/src/runtime/mgc.go @@ -663,7 +663,7 @@ func gcStart(trigger gcTrigger) { // Assists and workers can start the moment we start // the world. - gcController.startCycle(now) + gcController.startCycle(now, int(gomaxprocs)) work.heapGoal = gcController.heapGoal // In STW mode, disable scheduling of user Gs. This may also @@ -889,7 +889,7 @@ top: // endCycle depends on all gcWork cache stats being flushed. // The termination algorithm above ensured that up to // allocations since the ragged barrier. - nextTriggerRatio := gcController.endCycle(work.userForced) + nextTriggerRatio := gcController.endCycle(now, int(gomaxprocs), work.userForced) // Perform mark termination. This will restart the world. gcMarkTermination(nextTriggerRatio) |