Skip to content

Commit 1f26864

Browse files
committed
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 <[email protected]> Reviewed-by: Russ Cox <[email protected]>
1 parent 73c2080 commit 1f26864

File tree

2 files changed

+7
-17
lines changed

2 files changed

+7
-17
lines changed

src/runtime/extern.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ It is a comma-separated list of name=val pairs setting these named variables:
6666
length of the pause. Setting gctrace=2 emits the same summary but also
6767
repeats each collection. The format of this line is subject to change.
6868
Currently, it is:
69-
gc # @#s #%: #+...+# ms clock, #+...+# ms cpu, #->#-># MB, # MB goal, # P
69+
gc # @#s #%: #+#+# ms clock, #+#/#/#+# ms cpu, #->#-># MB, # MB goal, # P
7070
where the fields are as follows:
7171
gc # the GC number, incremented at each GC
7272
@#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:
7575
#->#-># MB heap size at GC start, at GC end, and live heap
7676
# MB goal goal heap size
7777
# P number of processors used
78-
The phases are stop-the-world (STW) sweep termination, scan,
79-
synchronize Ps, mark, and STW mark termination. The CPU times
80-
for mark are broken down in to assist time (GC performed in
78+
The phases are stop-the-world (STW) sweep termination, concurrent
79+
mark and scan, and STW mark termination. The CPU times
80+
for mark/scan are broken down in to assist time (GC performed in
8181
line with allocation), background GC time, and idle GC time.
8282
If the line ends with "(forced)", this GC was forced by a
8383
runtime.GC() call and all phases are STW.

src/runtime/mgc.go

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1263,32 +1263,22 @@ func gcMarkTermination() {
12631263
if debug.gctrace > 0 {
12641264
util := int(memstats.gc_cpu_fraction * 100)
12651265

1266-
// Install WB phase is no longer used.
1267-
tInstallWB := work.tMark
1268-
installWBCpu := int64(0)
1269-
1270-
// Scan phase is no longer used.
1271-
tScan := tInstallWB
1272-
scanCpu := int64(0)
1273-
1274-
// TODO: Clean up the gctrace format.
1275-
12761266
var sbuf [24]byte
12771267
printlock()
12781268
print("gc ", memstats.numgc,
12791269
" @", string(itoaDiv(sbuf[:], uint64(work.tSweepTerm-runtimeInitTime)/1e6, 3)), "s ",
12801270
util, "%: ")
12811271
prev := work.tSweepTerm
1282-
for i, ns := range []int64{tScan, tInstallWB, work.tMark, work.tMarkTerm, work.tEnd} {
1272+
for i, ns := range []int64{work.tMark, work.tMarkTerm, work.tEnd} {
12831273
if i != 0 {
12841274
print("+")
12851275
}
12861276
print(string(fmtNSAsMS(sbuf[:], uint64(ns-prev))))
12871277
prev = ns
12881278
}
12891279
print(" ms clock, ")
1290-
for i, ns := range []int64{sweepTermCpu, scanCpu, installWBCpu, gcController.assistTime, gcController.dedicatedMarkTime + gcController.fractionalMarkTime, gcController.idleMarkTime, markTermCpu} {
1291-
if i == 4 || i == 5 {
1280+
for i, ns := range []int64{sweepTermCpu, gcController.assistTime, gcController.dedicatedMarkTime + gcController.fractionalMarkTime, gcController.idleMarkTime, markTermCpu} {
1281+
if i == 2 || i == 3 {
12921282
// Separate mark time components with /.
12931283
print("/")
12941284
} else if i != 0 {

0 commit comments

Comments
 (0)