解释pprof堆图表

huangapple go评论82阅读模式
英文:

Interpreting pprof heap diagrams

问题

当我使用pprof在Go中分析堆时,我得到了以下结果:

解释pprof堆图表

然而,我不清楚如何解释这个可视化结果。特别是:

“箭头旁边的内存表示_______,方框内部的内存表示_______。所以当一个方框有多个箭头指向它时,表示_______,当一个方框有多个箭头从它指出时,表示_______。”

英文:

When I profile the heap in go with pprof I get the following:

解释pprof堆图表

However, I'm not clear on how to interpret that visualization. In particular:

"The memory next to the arrows means _____ and the memory inside of a box means ______. So when a box has multiple arrows from it, it means _____, and when it has multiple arrows to it, it means _____".

答案1

得分: 17

  1. 这个函数的感知累积内存消耗,包括其所有子函数
  2. 这个函数的感知内存消耗,不包括其所有子函数
  3. 它调用多个子函数
  4. 多个函数调用它

堆和CPU分析模式之间的箭头的含义没有区别。

您可能对top pprof命令的输出感兴趣,它可以以以下形式给出结果:

9701.61kB of 9701.61kB total (  100%) Dropped 112 nodes (cum <=
48.51kB) Showing top 10 nodes out of 29 (cum >= 3611.54kB)
      flat  flat%   sum%        cum   cum%
 4549.72kB 46.90% 46.90%  4549.72kB 46.90%  mystery.function
 2587.52kB 26.67% 73.57%  2587.52kB 26.67%  reflect.unsafe_NewArray
 1024.02kB 10.56% 84.12%  1024.02kB 10.56%  encoding/xml.copyValue
     514kB  5.30% 89.42%      514kB  5.30%  compress/gzip.NewReader
     514kB  5.30% 94.72%      514kB  5.30%  net/http.(*Transport).dialConn
  512.34kB  5.28%   100%   512.34kB  5.28%  runtime.makeslice
         0     0%   100%      514kB  5.30%  bytes.(*Buffer).ReadFrom
         0     0%   100%  3611.54kB 37.23%  encoding/xml.(*Decoder).Decode
         0     0%   100%  3611.54kB 37.23%  encoding/xml.(*Decoder).DecodeElement
         0     0%   100%  3611.54kB 37.23%  encoding/xml.(*Decoder).unmarshal

以下是关于使用pprof进行Go堆分析的两个最佳参考资料(依我之见):

  1. https://google-perftools.googlecode.com/svn/trunk/doc/heapprofile.html
  2. https://software.intel.com/en-us/blogs/2014/05/10/debugging-performance-issues-in-go-programs
英文:
  1. the perceived cumulative memory consumption of this function including all of its subfunctions
  2. the perceived memory consumption of this function excluding all of its subfunctions
  3. that it calls multiple subfunctions
  4. that multiple functions call it

No difference between the meaning of the arrows between the heap and the CPU profiling mode.

You may be interested in the output of the top pprof command, which can give you results in the following form:

9701.61kB of 9701.61kB total (  100%) Dropped 112 nodes (cum <=
48.51kB) Showing top 10 nodes out of 29 (cum >= 3611.54kB)
      flat  flat%   sum%        cum   cum%
 4549.72kB 46.90% 46.90%  4549.72kB 46.90%  mystery.function
 2587.52kB 26.67% 73.57%  2587.52kB 26.67%  reflect.unsafe_NewArray
 1024.02kB 10.56% 84.12%  1024.02kB 10.56%  encoding/xml.copyValue
     514kB  5.30% 89.42%      514kB  5.30%  compress/gzip.NewReader
     514kB  5.30% 94.72%      514kB  5.30%  net/http.(*Transport).dialConn
  512.34kB  5.28%   100%   512.34kB  5.28%  runtime.makeslice
         0     0%   100%      514kB  5.30%  bytes.(*Buffer).ReadFrom
         0     0%   100%  3611.54kB 37.23%  encoding/xml.(*Decoder).Decode
         0     0%   100%  3611.54kB 37.23%  encoding/xml.(*Decoder).DecodeElement
         0     0%   100%  3611.54kB 37.23%  encoding/xml.(*Decoder).unmarshal

And here are (IMHO) the two best references for Go heap profiling with pprof:

  1. https://google-perftools.googlecode.com/svn/trunk/doc/heapprofile.html
  2. https://software.intel.com/en-us/blogs/2014/05/10/debugging-performance-issues-in-go-programs

huangapple
  • 本文由 发表于 2016年3月8日 23:26:08
  • 转载请务必保留本文链接:https://go.coder-hub.com/35871365.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定