在我的主要版块中有以下内容:
func main() {
defer profile.Start().Stop()
fmt.Println("running version", version, "built on", date)
fmt.Println()
cmd.Execute()
time.Sleep(2 * time.Second)
}
哪里
cmd
是一个cobra子命令。我做了一个go构建,然后运行二进制文件。我可以看到它产生了
pprof
文件:
2018/09/13 18:43:26 profile: cpu profiling enabled, /tmp/profile705487093/cpu.pprof
... output deleted ...
2018/09/13 18:43:31 profile: cpu profiling disabled, /tmp/profile705487093/cpu.pprof
go tool pprof /root/code/debug/evented /tmp/profile705487093/cpu.pprof
File: evented
Type: cpu
Time: Sep 13, 2018 at 6:43pm (UTC)
Duration: 5.49s, Total samples = 0
go version go1.11 linux/amd64
在
Ubuntu 16.04.5 LTS
. 我不确定这是否重要,但我正试图检查数字海洋水滴的输出。
我做错什么了吗?谢谢!