1
0
mirror of https://github.com/golang/go synced 2024-11-18 12:54:44 -07:00

runtime: include heap goal in gctrace line

This may or may not be useful to the end user, but it's incredibly
useful for us to understand the behavior of the pacer. Currently this
is fairly easy (though not trivial) to derive from the other heap
stats we print, but we're about to change how we compute the goal,
which will make it much harder to derive.

Change-Id: I796ef233d470c01f606bd9929820c01ece1f585a
Reviewed-on: https://go-review.googlesource.com/9176
Reviewed-by: Rick Hudson <rlh@golang.org>
This commit is contained in:
Austin Clements 2015-04-21 16:38:38 -04:00
parent 1f39beb01a
commit 1ccc577b8a

View File

@ -684,7 +684,7 @@ func gc(mode int) {
// debug.gctrace variables
var stwprocs, maxprocs int32
var tSweepTerm, tScan, tInstallWB, tMark, tMarkTerm int64
var heap0, heap1, heap2 uint64
var heap0, heap1, heap2, heapGoal uint64
// Ok, we're doing it! Stop everybody else
semacquire(&worldsema, false)
@ -732,6 +732,7 @@ func gc(mode int) {
if mode == gcBackgroundMode { // Do as much work concurrently as possible
gcController.startCycle()
heapGoal = gcController.heapGoal
systemstack(func() {
gcphase = _GCscan
@ -791,6 +792,7 @@ func gc(mode int) {
if debug.gctrace > 0 {
t := nanotime()
tScan, tInstallWB, tMark, tMarkTerm = t, t, t, t
heapGoal = heap0
}
}
@ -923,6 +925,7 @@ func gc(mode int) {
"/", gcController.idleMarkTime/1e6,
"+", markTermCpu/1e6, " ms cpu, ",
heap0>>20, "->", heap1>>20, "->", heap2>>20, " MB, ",
heapGoal>>20, " MB goal, ",
maxprocs, " P")
if mode != gcBackgroundMode {
print(" (forced)")