Home > Article > Backend Development > Why is my Go `pprof` output showing blank results despite accurate application performance?
Go Tool Pprof Output Inconsistencies
The query revolves around the inexplicable output of the 'pprof' tool in Go, which provides profiling capabilities. Despite accurate performance in the past, the tool has recently started generating inconclusive results.
Regardless of the application being profiled, even relatively complex ones with numerous function calls, the 'pprof' tool returns bland call graphs and barren results, despite the applications themselves functioning properly.
The issue has persisted even after upgrading to MacOS Yosemite and El Capitan. The package 'github.com/davecheney/profile' is employed with Go v1.5.1.
To generate the profiles, the code includes 'profile.Start' and 'profile.Stop' at the beginning of the 'main' function, followed by the building and running of the binary. However, the resulting output resembles the following:
(pprof) top 269.97kB of 269.97kB total ( 100%) flat flat% sum% cum cum% 269.97kB 100% 100% 269.97kB 100% (pprof)
The provided solution resolves this discrepancy by emphasizing the absence of the binary in the 'pprof' call. The correct command structure is:
go tool pprof ./orig /path/to/profile.pprof
This correction ensures that 'pprof' targets the compiled binary, enabling it to provide the desired profiling information.
The above is the detailed content of Why is my Go `pprof` output showing blank results despite accurate application performance?. For more information, please follow other related articles on the PHP Chinese website!