Go gctrace中与时间相关的字段

Go gctrace中与时间相关的字段,go,garbage-collection,Go,Garbage Collection,我试图理解在运行从Go(v1.7)程序编译的一组可执行文件的系统上启用GODEBUG=gctrace=1时提到的确切计时字段 我用来获取统计数据的命令是: GODEBUG=gctrace=1 ~/golang/go/bin/godoc -http=:5555 -index 现在,文件上说: gctrace: setting gctrace=1 causes the garbage collector to emit a single line to standard error at each

我试图理解在运行从Go(v1.7)程序编译的一组可执行文件的系统上启用
GODEBUG=gctrace=1
时提到的确切计时字段

我用来获取统计数据的命令是:

GODEBUG=gctrace=1 ~/golang/go/bin/godoc -http=:5555 -index
现在,文件上说:

gctrace: setting gctrace=1 causes the garbage collector to emit a single line to standard
error at each collection, summarizing the amount of memory collected and the
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
where the fields are as follows:
    gc #        the GC number, incremented at each GC
    @#s         time in seconds since program start
    #%          percentage of time spent in GC since program start
    #+...+#     wall-clock/CPU times for the phases of the GC
    #->#-># 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, 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.
输出的样本行是:

gc 408 @4005.361s 0%: 0.061+86+1.2 ms clock, 1.9+0/1412/3894+38 ms cpu, 1080->1095->556 MB, 1108 MB goal, 72 P
我试图理解的是与时间相关的两个字段:

0.061+86+1.2毫秒时钟
1.9+0/1412/3894+38毫秒cpu

因此,根据文件:

STW sweep termination: 0.061 ms
Concurrent mark and scan: 86 ms
STW mark termination: 1.2 ms
现在,第二组时间应该是先前标记/扫描时间的细分。但它们似乎相当大(
3894ms
?),我不理解混合中的
+
。它们表示什么,以及细分如何比值大?

因此
1.9+0/1412/3894+38ms cpu
表示:

   1.9 sweepTermCpu, 
   0   gcController.assistTime, 
1412   gcController.dedicatedMarkTime + gcController.fractionalMarkTime,
3894   gcController.idleMarkTime, 
  38   markTermCpu
在这个循环中花费的纳秒。
GC利用空闲处理器做一些标记也就不足为奇了

// gcMarkWorkerIdleMode indicates that a P is running the mark
// worker because it has nothing else to do. The idle worker
// should run until it is preempted and account its time
// against gcController.idleMarkTime.
gcMarkWorkerIdleMode

实际上有一个声明说GC做得不够(!),应该唤醒空闲的处理器。

这很有趣,谢谢。请您解释一下“空闲标记”是什么意思,或者提供一个指向它的链接。@user1952500我没有太多额外的东西,无论如何,谢谢您的回答。这肯定回答了这个问题。
// gcMarkWorkerIdleMode indicates that a P is running the mark
// worker because it has nothing else to do. The idle worker
// should run until it is preempted and account its time
// against gcController.idleMarkTime.
gcMarkWorkerIdleMode