如何獲得命中數(shù),例如:(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不,持續(xù)時間如下:(pprof) top2220ms 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_errnoenv:我使用的是 golang1.4,添加以下代碼。defer pprof.StopCPUProfile()f, err := os.Create("innercpu.pprof")if err != nil { fmt.Println("Error: ", err)}pprof.StartCPUProfile(f)
1 回答

森欄
TA貢獻(xiàn)1810條經(jīng)驗 獲得超5個贊
您可以使用go tool pprof -callgrind -output callgrind.out innercpu.pprof
從收集的分析數(shù)據(jù)中生成 callgrind 數(shù)據(jù)。然后您可以使用qcachegrind/kcachegrind進(jìn)行可視化。它將顯示呼叫計數(shù)。
- 1 回答
- 0 關(guān)注
- 213 瀏覽
添加回答
舉報
0/150
提交
取消