diff options
author | Michael Anthony Knyszek <mknyszek@google.com> | 2019-12-27 16:48:23 +0000 |
---|---|---|
committer | Michael Knyszek <mknyszek@google.com> | 2020-01-09 18:00:06 +0000 |
commit | 8ac98e7b3fcadc497c4ca7d8637ba9578e8159be (patch) | |
tree | 7590cfe506165a3232b6457afef41073f75f347d /src/runtime/mheap.go | |
parent | 509592d188f6a30bb65b27a24f4c6f68716ea063 (diff) | |
download | go-8ac98e7b3fcadc497c4ca7d8637ba9578e8159be.tar.gz go-8ac98e7b3fcadc497c4ca7d8637ba9578e8159be.zip |
runtime: add scavtrace debug flag and remove scavenge info from gctrace
Currently, scavenging information is printed if the gctrace debug
variable is >0. Scavenging information is also printed naively, for
every page scavenged, resulting in a lot of noise when the typical
expectation for GC trace is one line per GC.
This change adds a new GODEBUG flag called scavtrace which prints
scavenge information roughly once per GC cycle and removes any scavenge
information from gctrace. The exception is debug.FreeOSMemory, which may
force an additional line to be printed.
Fixes #32952.
Change-Id: I4177dcb85fe3f9653fd74297ea93c97c389c1811
Reviewed-on: https://go-review.googlesource.com/c/go/+/212640
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/runtime/mheap.go')
-rw-r--r-- | src/runtime/mheap.go | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/runtime/mheap.go b/src/runtime/mheap.go index d8bba1f871..5427d8839d 100644 --- a/src/runtime/mheap.go +++ b/src/runtime/mheap.go @@ -70,7 +70,7 @@ type mheap struct { // on the swept stack. sweepSpans [2]gcSweepBuf - _ uint32 // align uint64 fields on 32-bit for atomics + // _ uint32 // align uint64 fields on 32-bit for atomics // Proportional sweep // @@ -1434,11 +1434,8 @@ func (h *mheap) scavengeAll() { unlock(&h.lock) gp.m.mallocing-- - if debug.gctrace > 0 { - if released > 0 { - print("forced scvg: ", released>>20, " MB released\n") - } - print("forced scvg: inuse: ", memstats.heap_inuse>>20, ", idle: ", memstats.heap_idle>>20, ", sys: ", memstats.heap_sys>>20, ", released: ", memstats.heap_released>>20, ", consumed: ", (memstats.heap_sys-memstats.heap_released)>>20, " (MB)\n") + if debug.scavtrace > 0 { + printScavTrace(released, true) } } |