Skip to content

Commit

Permalink
runtime: clean up gctrace format
Browse files Browse the repository at this point in the history
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 golang#13536.

Change-Id: I4fc37a3ce1ae3a99d48c0be2df64cbda3e05dee6
Reviewed-on: https://go-review.googlesource.com/18458
Run-TryBot: Austin Clements <[email protected]>
Reviewed-by: Russ Cox <[email protected]>
  • Loading branch information
aclements committed Jan 8, 2016
1 parent 73c2080 commit 1f26864
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 17 deletions.
8 changes: 4 additions & 4 deletions src/runtime/extern.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
repeats each collection. The format of this line is subject to change.
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:
gc # the GC number, incremented at each GC
@#s time in seconds since program start
Expand All @@ -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 goal goal heap size
# P number of processors used
The phases are stop-the-world (STW) sweep termination, scan,
synchronize Ps, mark, and STW mark termination. The CPU times
for mark are broken down in to assist time (GC performed in
The phases are stop-the-world (STW) sweep termination, concurrent
mark and scan, and STW mark termination. The CPU times
for mark/scan are broken down in to assist time (GC performed in
line with allocation), background GC time, and idle GC time.
If the line ends with "(forced)", this GC was forced by a
runtime.GC() call and all phases are STW.
Expand Down
16 changes: 3 additions & 13 deletions src/runtime/mgc.go
Original file line number Diff line number Diff line change
Expand Up @@ -1263,32 +1263,22 @@ func gcMarkTermination() {
if debug.gctrace > 0 {
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
printlock()
print("gc ", memstats.numgc,
" @", string(itoaDiv(sbuf[:], uint64(work.tSweepTerm-runtimeInitTime)/1e6, 3)), "s ",
util, "%: ")
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 {
print("+")
}
print(string(fmtNSAsMS(sbuf[:], uint64(ns-prev))))
prev = ns
}
print(" ms clock, ")
for i, ns := range []int64{sweepTermCpu, scanCpu, installWBCpu, gcController.assistTime, gcController.dedicatedMarkTime + gcController.fractionalMarkTime, gcController.idleMarkTime, markTermCpu} {
if i == 4 || i == 5 {
for i, ns := range []int64{sweepTermCpu, gcController.assistTime, gcController.dedicatedMarkTime + gcController.fractionalMarkTime, gcController.idleMarkTime, markTermCpu} {
if i == 2 || i == 3 {
// Separate mark time components with /.
print("/")
} else if i != 0 {
Expand Down

0 comments on commit 1f26864

Please sign in to comment.