dongou2019 2017-07-25 16:36
浏览 61
已采纳

pprof(用于golang)未显示我的软件包的详细信息

I've been trying to profile my go application (evm-specification-miner) with pprof, but the output is not really useful:

(pprof) top5
108.59mins of 109.29mins total (99.36%)
Dropped 607 nodes (cum <= 0.55mins)
Showing top 5 nodes out of 103 (cum >= 0.98mins)
      flat  flat%   sum%        cum   cum%
  107.83mins 98.66% 98.66% 108.64mins 99.40%  [evm-specification-miner]
  0.36mins  0.33% 98.99%      6mins  5.49%  net.dialIP
  0.30mins  0.28% 99.27%   4.18mins  3.83%  net.listenIP
  0.06mins 0.052% 99.32%  34.66mins 31.71%  
github.com/urfave/cli.BoolFlag.ApplyWithError
  0.04mins 0.036% 99.36%   0.98mins   0.9%  net.probeIPv6Stack

And here is the cumulative output:

(pprof) top5 --cum
1.80hrs of 1.82hrs total (98.66%)
Dropped 607 nodes (cum <= 0.01hrs)
Showing top 5 nodes out of 103 (cum >= 1.53hrs)
      flat  flat%   sum%        cum   cum%
   1.80hrs 98.66% 98.66%    1.81hrs 99.40%  [evm-specification-miner]
         0     0% 98.66%    1.53hrs 83.93%  net.IP.matchAddrFamily
         0     0% 98.66%    1.53hrs 83.92%  net.(*UDPConn).WriteToUDP
         0     0% 98.66%    1.53hrs 83.90%  net.sockaddrToUDP
         0     0% 98.66%    1.53hrs 83.89%  net.(*UDPConn).readMsg

As you can see, most of the time is spent in evm-specification-miner (which is the name of my go application), but I've been unable to obtain more details or even understand what these square brackets meant (there is a question with a similar problem, but it didn't receive any answer).

Here are the build and pprof commands:

go install evm-specification-miner
go tool pprof evm-specification-miner cpuprof

I've even tried the debug flags -gcflags "-N -l" (as noted here: https://golang.org/doc/gdb#Introduction), to no avail.

The profiling is done with calls to pprof.StartCPUProfile() and pprof.StopCPUProfile() as is explained by this blog post: https://blog.golang.org/profiling-go-programs:

func StartProfiling(cpuprof string) error {
    f, err := os.Create(cpuprof)
    if err != nil {
        return err
    }
    return pprof.StartCPUProfile(f)
}

func StopProfiling() error {
    pprof.StopCPUProfile()
    return nil
}

StartProfiling is called at the beginning of main(), and StopProfiling when a signal (interrupt or kill) is received (or if the program terminates normally). This profile was obtained after an interruption.

  • 写回答

1条回答 默认 最新

  • doumi4676 2017-07-26 17:01
    关注

    Looks like updating to 1.9rc1 fixed it.

    I no longer have [evm-specifiation-miner] in the profile (for the record, the top functions do not even come from my own package, so it is even weirder than they did not appear before).

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 韩国网站购物,KG支付的支付回调如何解决
  • ¥15 workstation导入ovf文件,报错,怎么解决呢?
  • ¥15 关于#c语言#的问题:构成555单稳态触发器,采用LED指示灯延时时间,对延时时间进行测量并显示(如楼道声控延时灯)需要Proteus仿真图和C语言代码
  • ¥15 workstation加载centos进入emergency模式,查看日志报警如图,怎样解决呢?
  • ¥50 如何用单纯形法寻优不能精准找不到给定的参数,并联机构误差识别,给定误差有7个?matlab
  • ¥15 workstation加载centos进入emergency模式,查看日志报警如图,没有XFS,怎样解决呢?
  • ¥15 应用商店如何检测在架应用内容是否违规?
  • ¥15 Ubuntu系统配置PX4
  • ¥50 nw.js调用activex
  • ¥15 数据库获取信息反馈出错,直接查询了ref字段并且还使用了User文档的_id而不是自己的