Go的GC打印出来的信息
wu53 · · 2134 次点击 · · 开始浏览环境
本文的go版本是 go1.8 linux/amd64。
启动程序
设置环境变量GODEBUG,然后启动程序。假如程序叫proc,则启动命令为:
GODEBUG=gctrace=1 ./proc
gc信息
gc打印的内容像这样的:gc 1 @0.045s 22%: 4.6+182+0.38 ms clock, 9.2+0/96/86+0.77 ms cpu, 52->52->52 MB, 53 MB goal, 2 P
gc打印的信息格式大概如下:
gc # @#s #%: #+...+# ms clock, #+...+# ms cpu, #->#-># MB, # MB goal, # P
字段含义如下:
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
参考:
http://stackoverflow.com/questions/20551748/decipher-golang-garbage-collection-output
有疑问加站长微信联系(非本文作者)
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
关注微信- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码` - 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传
收入到我管理的专栏 新建专栏
环境
本文的go版本是 go1.8 linux/amd64。
启动程序
设置环境变量GODEBUG,然后启动程序。假如程序叫proc,则启动命令为:
GODEBUG=gctrace=1 ./proc
gc信息
gc打印的内容像这样的:gc 1 @0.045s 22%: 4.6+182+0.38 ms clock, 9.2+0/96/86+0.77 ms cpu, 52->52->52 MB, 53 MB goal, 2 P
gc打印的信息格式大概如下:
gc # @#s #%: #+...+# ms clock, #+...+# ms cpu, #->#-># MB, # MB goal, # P
字段含义如下:
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
参考:
http://stackoverflow.com/questions/20551748/decipher-golang-garbage-collection-output