What is the meaning of "flat" and "cum" in golang pprof output

blov · · 895 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<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 &#34;cum&#34; 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&#39;s possible that flat and cumulative are the same.</p></pre>YuchenLiu1993: <pre><p>So &#34;flat&#34; is always greater equal than &#34;cum&#34;?</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 &#34;do something directly&#34; 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

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