pprof unrecognized profile format

go tool pprof -http=:8080 http://10.179.90.133:9981/debug/pprof/trace?seconds=60
Fetching profile over HTTP from http://10.179.90.133:9981/debug/pprof/trace?seconds=60
^[[A http://10.179.90.133:9981/debug/pprof/trace?seconds=60: parsing profile: unrecognized profile format
failed to fetch any source profiles



原因
trace的格式和profile的格式不一样,因此用pprof没法解析
应该用go tool trace

go tool trace -http=:8080 http://10.179.90.133:9981/debug/pprof/trace?seconds=60
2020/03/27 11:02:59 Parsing trace…
failed to open trace file: open http://10.179.90.133:9981/debug/pprof/trace?seconds=60: no such file or directory



curl http://10.179.90.133:9981/debug/pprof/trace?seconds=60 >trace.data
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 2687k 0 2687k 0 0 22026 0 –:–:– 0:02:04 –:–:– 83619



go tool trace -http=:8080 trace.data
2020/03/27 11:08:38 Parsing trace…
2020/03/27 11:08:39 Splitting trace…
2020/03/27 11:08:40 Opening browser. Trace viewer is listening on http://[::]:8080



go tool pprof http://localhost:6060/debug/pprof/heap这种方式出现了错误parsing profile: unrecognized profile format



少了一些东西,应该是这样 go tool pprof http://127.0.0.1:8601/debug/pprof/heap?debug=1,或者使用浏览器直接访问 http://127.0.0.1:8601/debug/pprof/ ,最后的斜杠不要忘了



https://grokbase.com/t/gg/golang-nuts/1565wps459/go-nuts-go-execution-tracer-parsing-profile-unrecognized-profile-format


Category golang