golang工具pprof无法正常工作 - 不管分析目标如何,输出相同 [英] golang tool pprof not working properly - same broken output regardless of profiling target
问题描述
我之前使用pprof工具没有问题,它工作得很好 - 现在我看到输出如下,无论我的个人资料:
$ b 在这个例子中被分析的应用程序可能会产生40多个函数调用,甚至更复杂的应用程序也会为cpu和memprofiling产生类似的调用图。 / p>
试图配置文件的应用程序都是Web应用程序,我一次性对它们进行一分钟分析,并使用wrk生成200,000,000+个请求=全部返回数据和2xx响应
pprof几天前突然停止运行osx yosemite - 试图解决我最近升级到el capitan的问题,但结果是一样的。
注意:这不仅仅是调用图表 - 调用列表或顶级命令会产生类似的贫瘠结果,但应用程序(pprof)top
269.97kB共269.97kB(100%)$ b $($)$ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ b flat flat%%%cum%%
269.97kB 100%100%269.97kB 100%b $ b(pprof)
我正在使用以下软件包:github.com/davecheney/profilewith go v1.5.1
为了清楚起见,下面是我正在做生成配置文件::
我将上面的包导入到main.go中,并将以下内容放置在主func的顶部:
推迟profile.Start(profile.MemProfile).Stop()
然后构建二进制文件并运行它:
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 / User s / 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
然后我看到如下输出:
2015/11/16 11:39:49 profile:启用内存分析,/var/folders/26/2sj70_sn72l_93j7tf6r07gr0000gn/T/profile614358295/mem.pprof
现在我从另一个终端开始工作:
wrk -d60 -c10 -HX-Device:desktop-HX-Country-Code:GBhttp:// localhost:8189 / app?id = 111& schema = xml2& ad_type = auto& url = http://test.com/& category = bob
运行1m测试@ http:// localhost:8189 / app?id = 111& schema = XML2&安培; AD_TYPE = auto& url = http://test.com/& category = bob
2个线程和10个连接
线程统计平均Stdev最大+/- Stdev
延迟414.09us 0.92ms 55.36ms 95.66%
需求/秒17.57k 3.19k 22.59k 76.00%
2097764请求在1.00m,684.20MB read
请求/秒:34958.03
转移/秒:11.40MB
60秒后,我回去查看个人资料:
^ C2015 / 11/16 12:05:20 profile:捕获中断,停止配置文件
go工具pprof / var / folders / 26 / 2sj70_sn72l_93j7tf6r07gr0000gn / T / profile614358295 / mem.pprof
任何想法可能发生在这里或我可以开始的位置有疑难解答/解决这个问题?
欢迎提供任何帮助建议。
<您的 go工具pprof
调用缺少二进制文件本身。将它称为
go tool pprof ./orig /path/to/profile.pprof
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:
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.
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
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.
Note: this is not just call graphs - calling list or top command produce similarly barren results but the apps themselves work fine:
(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
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:
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:
^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. Call it as
go tool pprof ./orig /path/to/profile.pprof
这篇关于golang工具pprof无法正常工作 - 不管分析目标如何,输出相同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!