繁体   English   中英

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

[英]golang profile with pprof, how to get hit count not duration?

如何获得点击数:

(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 tool pprof -callgrind -output callgrind.out innercpu.pprof innercpu.pprof从收集的分析数据中生成callgrind数据。 然后,您可以使用qcachegrind / kcachegrind进行可视化。 它会显示通话计数。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM