gpt4 book ai didi

go - 读取 Go gctrace 输出

转载 作者:IT王子 更新时间:2023-10-29 02:03:32 24 4
gpt4 key购买 nike

我的 gctrace 输出如下所示:

gc 6 @48.155s 15%: 0.093+12360+0.32 ms clock, 0.18+7720/21356/3615+0.65 ms cpu, 11039->13278->6876 MB, 14183 MB goal, 8 P

我不确定具体如何读取 CPU 时间。我知道它分为三个阶段(STW 扫描终止、并发标记/扫描和 STW 标记终止),但我不确定 + 符号的含义(即 0.18+77203615+0.65)。这些 + 符号表示什么?

最佳答案

在您的情况下,它们看起来像是协助和终止时间;

// CPU time
0.18 : **STW** Sweep termination.
7720ms : Mark/Scan - Assist Time (GC performed in line with allocation).
21356ms : Mark/Scan - Background GC time.
3615ms : Mark/Scan - Idle GC time.
0.65ms : **STW** Mark termination.

我认为它会在各种 Go 版本中发生变化(或可能发生变化),您可以在 runtime package docs 找到更多详细信息。 .

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

示例 here

另见 Interpreting GC trace output

gc 6 @48.155s 15%: 0.093+12360+0.32 ms clock,
0.18+7720/21356/3615+0.65 ms cpu, 11039->13278->6876 MB, 14183 MB goal, 8 P
  • gc 6
  • @48.155s自程序开始
  • 15%:自程序启动以来花在 GC 上的时间
  • 0.093+12360+0.32 毫秒时钟 停止世界 (STW) 扫描终止 + 并发标记扫描+和STW标记终止
  • 0.18+7720/21356/3615+0.65 ms cpu(GC 在符合分配)、后台 GC 时间和空闲 GC 时间
  • 11039->13278->6876 MB GC 开始时、GC 结束时和事件堆的堆大小
  • 8 P 使用的处理器数量

关于go - 读取 Go gctrace 输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42380784/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com