Описание тега pprof
NonePprof is a golang package used to profile various runtime properties of golang's http server.
Golang's pprof package serves via its HTTP server runtime profiling data in the format expected by the pprof visualization tool.
The package is typically only imported for the side effect of registering its HTTP handlers. The handled paths all begin with /debug/pprof/
.
To use pprof, link this package into your program:
import _ "net/http/pprof"
If your application is not already running an http
server, you need to start one. Add "net/http"
and "log"
to your imports and the following code to your main function:
go func() {
log.Println(http.ListenAndServe("localhost:6060", nil))
}()
Then use the pprof tool to look at the heap profile:
go tool pprof http://localhost:6060/debug/pprof/heap