<p>New to golang pprof. What is the meaning of flat, cum in pprof?</p>
<hr/>**评论:**<br/><br/>GregMartinez: <pre><p>Flat is duration spent on given a function and cum is cumulative of current function plus calls above it.</p></pre>YuchenLiu1993: <pre><p>If a() call b() call ( c() and d() ) , c() takes 1s to execute and d() takes 2s so "cum" of b() is 1+2=3s?</p>
<p>But how to calculate flat of b() ?</p></pre>GregMartinez: <pre><p>Correct, cumulative of b would be c + d. Flat would be time directly in b. It's possible that flat and cumulative are the same.</p></pre>YuchenLiu1993: <pre><p>So "flat" is always greater equal than "cum"?</p></pre>fishywang: <pre><p>No. Assuming what in b() is:</p>
<pre><code>c() // takes 1s
do something directly // takes 3s
d() // takes 2s
</code></pre>
<p>then cum of b() would be 6s, and flat of b() would be 3s (assuming that the "do something directly" part does not have function calls).</p></pre>YuchenLiu1993: <pre><p>Thank you for correcting my fault! I get it now!</p></pre>YuchenLiu1993: <pre><p>Thanks! I get it now!</p></pre>
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
- 请尽量让自己的回复能够对别人有帮助
- 支持 Markdown 格式, **粗体**、~~删除线~~、
`单行代码`
- 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
- 图片支持拖拽、截图粘贴等方式上传