]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: include heap goal in gctrace line
authorAustin Clements <austin@google.com>
Tue, 21 Apr 2015 20:38:38 +0000 (16:38 -0400)
committerAustin Clements <austin@google.com>
Wed, 22 Apr 2015 19:07:44 +0000 (19:07 +0000)
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>
src/runtime/mgc.go

index 0e4f7cb81b921d2391434df0f39b96bc8c04ee7d..ebd4c33bdaa8b3af0e99a7634e477c5ae3411787 100644 (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)")