golang 配置文件与 pprof,如何获得命中数而不是持续时间?

标签 go profile pprof

如何获得命中数:

(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

env: 我用的是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 从收集的分析数据中生成 callgrind 数据。然后你可以用 qcachegrind/kcachegrind 可视化.它将显示调用计数。

关于golang 配置文件与 pprof,如何获得命中数而不是持续时间?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28924550/

相关文章:

eclipse - 如何让自动完成 (GoCode) 与我的所有导入一起使用?

rest - 使用类型嵌入访问特定字段?

windows-8 - pprof 堆报告显示原始内存地址

go - 如何在 net/http 中编写/api/v1/users/id/{id}?

linux - 将 .txt 文件的内容分类为 .bash_profile

php - 用于更新通过 facebook 连接导入的用户配置文件数据的 cron 作业

php $userid 错误,无法从 mysql 检索数据

go - time.Since() 的奇怪行为

go - golang中将byte[]转换为字符串奇怪占用堆

当状态为 301 且没有 Location header 时,HTTP 客户端不会返回响应