go tool pprof 字段翻译

云南厨子 · · 898 次点击 · · 开始浏览    
这是一个创建于 的文章,其中的信息可能已经有所发展或是发生改变。

一直对 go tool pprof xxx.prof字段不是很了解,群里人发了官方文档,翻一下做个记录

(pprof) top10
Total: 2525 samples
     298  11.8%  11.8%      345  13.7% runtime.mapaccess1_fast64
     268  10.6%  22.4%     2124  84.1% main.FindLoops
     251   9.9%  32.4%      451  17.9% scanblock
     178   7.0%  39.4%      351  13.9% hash_insert
     131   5.2%  44.6%      158   6.3% sweepspan
     119   4.7%  49.3%      350  13.9% main.DFS
      96   3.8%  53.1%       98   3.9% flushptrbuf
      95   3.8%  56.9%       95   3.8% runtime.aeshash64
      95   3.8%  60.6%      101   4.0% runtime.settype_flush
      88   3.5%  64.1%      988  39.1% runtime.mallocgc

原文:

When CPU profiling is enabled, the Go program stops about 100 times per second and records a sample consisting of the program counters on the currently executing goroutine's stack. The profile has 2525 samples, so it was running for a bit over 25 seconds. In the go tool pprof output, there is a row for each function that appeared in a sample. The first two columns show the number of samples in which the function was running (as opposed to waiting for a called function to return), as a raw count and as a percentage of total samples. The runtime.mapaccess1_fast64 function was running during 298 samples, or 11.8%. The top10 output is sorted by this sample count. The third column shows the running total during the listing: the first three rows account for 32.4% of the samples. The fourth and fifth columns show the number of samples in which the function appeared (either running or waiting for a called function to return). The main.FindLoops function was running in 10.6% of the samples, but it was on the call stack (it or functions it called were running) in 84.1% of the samples.

翻译:
当CPU profiling开启,Go程序1秒钟停止100次,来对goroutine栈调用进行连续采样并记录
本次调试总计有2525个采样,所以他执行时间超过25s
go tool pprof输出里,采样里的每个function有一行信息对应
前面2列是关于function在运行状态所在的所在的原始总样本数量和总比例
runtime.mapaccess1_fast64这个function在298个样本里运行过,或者占总比例的11.8%
top 10的输出是按照样本数倒叙排列的
第3列显示运行总是占列表里的比例,前面3行占样本的32.4%(第3行第3列:11.8%+10.6%+9.9%)
第4,5列展示function出现过的样本数和比例
main.FindLoops这个function只在10.6%的样本里执行过,但是在84.1%的调用栈里出现过

原文地址: https://blog.golang.org/profiling-go-programs


有疑问加站长微信联系(非本文作者)

本文来自:简书

感谢作者:云南厨子

查看原文:go tool pprof 字段翻译

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

898 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传