简体   繁体   English

golang tool pprof无法正常工作 - 无论性能分析目标如何,都会出现相同的断开输出

[英]golang tool pprof not working properly - same broken output regardless of profiling target

I've previously used the pprof tool without issue and it worked great - now I see output like the following no matter what I profile: 我之前使用过pprof工具没有问题,它工作得很好 - 现在我看到的输出如下,无论我简介:

pprof的输出

the application being profiled in this example probably makes 40+ function calls and even more complex apps are producing similar callgraphs for both cpu and memprofiling. 在这个例子中被分析的应用程序可能会进行40多个函数调用,甚至更复杂的应用程序也会为cpu和memprofiling生成类似的调用图。

The apps Im trying to profile are all web applications, I am profiling them for one minute at a time and using wrk to generate 200,000,000+ requests = all returning data and a 2xx response 我试图分析的应用程序都是Web应用程序,我一次分析它们一分钟并使用wrk生成200,000,000多个请求=所有返回数据和2xx响应

pprof suddenly stopped working a few days ago running osx yosemite - in an attempt to resolve the issue I recently upgraded to el capitan but result is the same. pprof几天前突然停止运行osx yosemite - 试图解决我最近升级到el capitan的问题,但结果是一样的。

Note: this is not just call graphs - calling list or top command produce similarly barren results but the apps themselves work fine: 注意:这不仅仅是调用图 - 调用列表或top命令产生类似的贫瘠结果,但应用程序本身工作正常:

    (pprof) top
269.97kB of 269.97kB total (  100%)
      flat  flat%   sum%        cum   cum%
  269.97kB   100%   100%   269.97kB   100%  
(pprof) 

I am using the following package: "github.com/davecheney/profile" with go v1.5.1 我正在使用以下软件包:“github.com/davecheney/profile”和go v1.5.1

For clarity, here's what I'm doing to generate the profiles:: 为清楚起见,这是我正在做的生成配置文件::

I import the above package into main.go and place the following at the top of my main func: 我将上面的包导入main.go并将以下内容放在我的主函数的顶部:

defer profile.Start(profile.MemProfile).Stop()

I then build the binary and run it: 然后我构建二进制文件并运行它:

go build -o orig /Users/danielwall/www/netlistener/application/adrequest.go /Users/danielwall/www/netlistener/application/cookie.go /Users/danielwall/www/netlistener/application/header.go /Users/danielwall/www/netlistener/application/lex.go /Users/danielwall/www/netlistener/application/main.go /Users/danielwall/www/netlistener/application/publisher_ids.go /Users/danielwall/www/netlistener/application/request.go /Users/danielwall/www/netlistener/application/response.go /Users/danielwall/www/netlistener/application/server.go /Users/danielwall/www/netlistener/application/sniff.go /Users/danielwall/www/netlistener/application/status.go /Users/danielwall/www/netlistener/application/transfer.go

./orig

I then see output like this: 然后我看到这样的输出:

2015/11/16 11:39:49 profile: memory profiling enabled, /var/folders/26/2sj70_sn72l_93j7tf6r07gr0000gn/T/profile614358295/mem.pprof

Now I work the app from another terminal : 现在我从另一个终端处理应用程序:

    wrk -d60 -c10 -H "X-Device: desktop" -H "X-Country-Code: GB" "http://localhost:8189/app?id=111&schema=xml2&ad_type=auto&url=http://test.com/&category=bob"
Running 1m test @ http://localhost:8189/app?id=111&schema=xml2&ad_type=auto&url=http://test.com/&category=bob
  2 threads and 10 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   414.09us    0.92ms  55.36ms   95.66%
    Req/Sec    17.57k     3.19k   22.59k    76.00%
  2097764 requests in 1.00m, 684.20MB read
Requests/sec:  34958.03
Transfer/sec:     11.40MB

After 60 seconds, I go back to check my profile: 60秒后,我回去查看我的个人资料:

^C2015/11/16 12:05:20 profile: caught interrupt, stopping profiles

go tool pprof /var/folders/26/2sj70_sn72l_93j7tf6r07gr0000gn/T/profile614358295/mem.pprof

Any ideas what might be happening here or where I could start with trouble shooting/solving this? 任何想法可能会发生在这里或在哪里我可以开始解决/解决这个问题?

Any help suggestions welcome. 欢迎任何帮助建议。

Your go tool pprof call is missing the binary itself. 你的go tool pprof调用缺少二进制文件本身。 Call it as 称之为

go tool pprof ./orig /path/to/profile.pprof

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM