2 回答

TA貢獻1836條經(jīng)驗 獲得超3個贊
好吧,這很簡單,我想添加二進制文件到 go tool pprof,si 它必須是
# go tool pprof write cpu.out
Entering interactive mode (type "help" for commands)
(pprof) top10
7.02s of 7.38s total (95.12%)
Dropped 14 nodes (cum <= 0.04s)
Showing top 10 nodes out of 32 (cum >= 0.19s)
flat flat% sum% cum cum%
6.55s 88.75% 88.75% 6.76s 91.60% syscall.Syscall
...
并且在使用基準測試時,會在那里創(chuàng)建二進制文件并使用它給出相同的結果。

TA貢獻1906條經(jīng)驗 獲得超3個贊
要擴展 sejvolnd 的答案:
pprof
需要實際生成cpu.out
文件的二進制文件作為第一個參數(shù)。
所以你需要運行命令 go tool pprof <go binary of your program> <generaged profiling output file>
例如 go tool pprof go_binary cpu.pprof
- 2 回答
- 0 關注
- 164 瀏覽
添加回答
舉報