Commit 1f26864f authored by Austin Clements's avatar Austin Clements

runtime: clean up gctrace format

Go 1.6 simplified the GC phases. The "synchronize Ps" phase no longer
exists and "root scan" and "mark" phases have been combined.

Update the gctrace line implementation and documentation to remove the
unused phases.

Fixes #13536.

Change-Id: I4fc37a3ce1ae3a99d48c0be2df64cbda3e05dee6
Reviewed-on: https://go-review.googlesource.com/18458
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: 's avatarRuss Cox <rsc@golang.org>
parent 73c2080a
...@@ -66,7 +66,7 @@ It is a comma-separated list of name=val pairs setting these named variables: ...@@ -66,7 +66,7 @@ It is a comma-separated list of name=val pairs setting these named variables:
length of the pause. Setting gctrace=2 emits the same summary but also length of the pause. Setting gctrace=2 emits the same summary but also
repeats each collection. The format of this line is subject to change. repeats each collection. The format of this line is subject to change.
Currently, it is: Currently, it is:
gc # @#s #%: #+...+# ms clock, #+...+# ms cpu, #->#-># MB, # MB goal, # P gc # @#s #%: #+#+# ms clock, #+#/#/#+# ms cpu, #->#-># MB, # MB goal, # P
where the fields are as follows: where the fields are as follows:
gc # the GC number, incremented at each GC gc # the GC number, incremented at each GC
@#s time in seconds since program start @#s time in seconds since program start
...@@ -75,9 +75,9 @@ It is a comma-separated list of name=val pairs setting these named variables: ...@@ -75,9 +75,9 @@ It is a comma-separated list of name=val pairs setting these named variables:
#->#-># MB heap size at GC start, at GC end, and live heap #->#-># MB heap size at GC start, at GC end, and live heap
# MB goal goal heap size # MB goal goal heap size
# P number of processors used # P number of processors used
The phases are stop-the-world (STW) sweep termination, scan, The phases are stop-the-world (STW) sweep termination, concurrent
synchronize Ps, mark, and STW mark termination. The CPU times mark and scan, and STW mark termination. The CPU times
for mark are broken down in to assist time (GC performed in for mark/scan are broken down in to assist time (GC performed in
line with allocation), background GC time, and idle GC time. line with allocation), background GC time, and idle GC time.
If the line ends with "(forced)", this GC was forced by a If the line ends with "(forced)", this GC was forced by a
runtime.GC() call and all phases are STW. runtime.GC() call and all phases are STW.
......
...@@ -1263,23 +1263,13 @@ func gcMarkTermination() { ...@@ -1263,23 +1263,13 @@ func gcMarkTermination() {
if debug.gctrace > 0 { if debug.gctrace > 0 {
util := int(memstats.gc_cpu_fraction * 100) util := int(memstats.gc_cpu_fraction * 100)
// Install WB phase is no longer used.
tInstallWB := work.tMark
installWBCpu := int64(0)
// Scan phase is no longer used.
tScan := tInstallWB
scanCpu := int64(0)
// TODO: Clean up the gctrace format.
var sbuf [24]byte var sbuf [24]byte
printlock() printlock()
print("gc ", memstats.numgc, print("gc ", memstats.numgc,
" @", string(itoaDiv(sbuf[:], uint64(work.tSweepTerm-runtimeInitTime)/1e6, 3)), "s ", " @", string(itoaDiv(sbuf[:], uint64(work.tSweepTerm-runtimeInitTime)/1e6, 3)), "s ",
util, "%: ") util, "%: ")
prev := work.tSweepTerm prev := work.tSweepTerm
for i, ns := range []int64{tScan, tInstallWB, work.tMark, work.tMarkTerm, work.tEnd} { for i, ns := range []int64{work.tMark, work.tMarkTerm, work.tEnd} {
if i != 0 { if i != 0 {
print("+") print("+")
} }
...@@ -1287,8 +1277,8 @@ func gcMarkTermination() { ...@@ -1287,8 +1277,8 @@ func gcMarkTermination() {
prev = ns prev = ns
} }
print(" ms clock, ") print(" ms clock, ")
for i, ns := range []int64{sweepTermCpu, scanCpu, installWBCpu, gcController.assistTime, gcController.dedicatedMarkTime + gcController.fractionalMarkTime, gcController.idleMarkTime, markTermCpu} { for i, ns := range []int64{sweepTermCpu, gcController.assistTime, gcController.dedicatedMarkTime + gcController.fractionalMarkTime, gcController.idleMarkTime, markTermCpu} {
if i == 4 || i == 5 { if i == 2 || i == 3 {
// Separate mark time components with /. // Separate mark time components with /.
print("/") print("/")
} else if i != 0 { } else if i != 0 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment