加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

用pprof golang profile,如何获得命中数而不是持续时间?

发布时间:2020-12-16 09:24:40 所属栏目:大数据 来源:网络整理
导读:如何获得点击数: (pprof) topTotal: 2525 samples 298 11.8% 11.8% 345 13.7% runtime.mapaccess1_fast64 268 10.6% 22.4% 2124 84.1% main.FindLoops 不,持续时间如: (pprof) top2220ms of 3080ms total (72.08%)Dropped 72 nodes (cum = 15.40ms)Showing
如何获得点击数:

(pprof) top
Total: 2525 samples
     298  11.8%  11.8%      345  13.7% runtime.mapaccess1_fast64
     268  10.6%  22.4%     2124  84.1% main.FindLoops

不,持续时间如:

(pprof) top
2220ms of 3080ms total (72.08%)
Dropped 72 nodes (cum <= 15.40ms)
Showing top 10 nodes out of 111 (cum >= 60ms)
      flat  flat%   sum%        cum   cum%
    1340ms 43.51% 43.51%     1410ms 45.78%  runtime.cgocall_errno

环境:我使用golang1.4,添加以下代码.

defer pprof.StopCPUProfile()
f,err := os.Create("innercpu.pprof")
if err != nil {
    fmt.Println("Error: ",err)
}
pprof.StartCPUProfile(f)

解决方法

您可以使用go工具pprof -callgrind -output callgrind.out innercpu.pprof从收集的分析数据中生成callgrind数据.然后您可以使用 qcachegrind/kcachegrind进行可视化.它将显示呼叫计数.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读