From 1ccc577b8a348d89b44d12ef6740c15d8fc10598 Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Tue, 21 Apr 2015 16:38:38 -0400 Subject: [PATCH] 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 --- src/runtime/mgc.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/runtime/mgc.go b/src/runtime/mgc.go index 0e4f7cb81b..ebd4c33bda 100644 --- a/src/runtime/mgc.go +++ b/src/runtime/mgc.go @@ -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)") -- 2.50.0