解释 pprof 堆图

当我使用 pprof 分析堆时,我得到以下信息:

http://img2.mukewang.com/61c036240001e85322021273.jpg

但是,我不清楚如何解释该可视化。特别是:

“箭头旁边的内存表示_____,盒子里面的内存表示______。所以当一个盒子有多个箭头时,它意味着_____,当它有多个箭头时,它意味着_____”。


宝慕林4294392
浏览 212回答 1
1回答

米琪卡哇伊

此函数(包括其所有子函数)的感知累积内存消耗此函数的感知内存消耗(不包括其所有子函数)它调用多个子函数多个函数调用它堆和 CPU 分析模式之间箭头的含义没有区别。您可能对toppprof 命令的输出感兴趣,它可以为您提供以下形式的结果:9701.61kB of 9701.61kB total (&nbsp; 100%) Dropped 112 nodes (cum <=48.51kB) Showing top 10 nodes out of 29 (cum >= 3611.54kB)&nbsp; &nbsp; &nbsp; flat&nbsp; flat%&nbsp; &nbsp;sum%&nbsp; &nbsp; &nbsp; &nbsp; cum&nbsp; &nbsp;cum%&nbsp;4549.72kB 46.90% 46.90%&nbsp; 4549.72kB 46.90%&nbsp; mystery.function&nbsp;2587.52kB 26.67% 73.57%&nbsp; 2587.52kB 26.67%&nbsp; reflect.unsafe_NewArray&nbsp;1024.02kB 10.56% 84.12%&nbsp; 1024.02kB 10.56%&nbsp; encoding/xml.copyValue&nbsp; &nbsp; &nbsp;514kB&nbsp; 5.30% 89.42%&nbsp; &nbsp; &nbsp; 514kB&nbsp; 5.30%&nbsp; compress/gzip.NewReader&nbsp; &nbsp; &nbsp;514kB&nbsp; 5.30% 94.72%&nbsp; &nbsp; &nbsp; 514kB&nbsp; 5.30%&nbsp; net/http.(*Transport).dialConn&nbsp; 512.34kB&nbsp; 5.28%&nbsp; &nbsp;100%&nbsp; &nbsp;512.34kB&nbsp; 5.28%&nbsp; runtime.makeslice&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0&nbsp; &nbsp; &nbsp;0%&nbsp; &nbsp;100%&nbsp; &nbsp; &nbsp; 514kB&nbsp; 5.30%&nbsp; bytes.(*Buffer).ReadFrom&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0&nbsp; &nbsp; &nbsp;0%&nbsp; &nbsp;100%&nbsp; 3611.54kB 37.23%&nbsp; encoding/xml.(*Decoder).Decode&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0&nbsp; &nbsp; &nbsp;0%&nbsp; &nbsp;100%&nbsp; 3611.54kB 37.23%&nbsp; encoding/xml.(*Decoder).DecodeElement&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0&nbsp; &nbsp; &nbsp;0%&nbsp; &nbsp;100%&nbsp; 3611.54kB 37.23%&nbsp; encoding/xml.(*Decoder).unmarshal这是(恕我直言)使用 pprof 进行 Go 堆分析的两个最佳参考:https://google-perftools.googlecode.com/svn/trunk/doc/heapprofile.htmlhttps://software.intel.com/en-us/blogs/2014/05/10/debugging-performance-issues-in-go-programs
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Go