Skip to content

Go

Profiling

to enable profile data-server

import _ "net/http/pprof"
go func() {
    log.Println(http.ListenAndServe("localhost:6060", nil))
}()

cpu-profile: 30s

go tool pprof "http://localhost:6060/debug/pprof/profile?seconds=30"

then to see topN methods, type

top5

for help, type

 help 

start web-server (make sure graphviz is installed)

go tool pprof -http=:8080 "http://localhost:6060/debug/pprof/profile?seconds=30"

to access profiles: command-line

to access profiles: web-interface

Visit on browser

http://localhost:6060/debug/pprof/

understand top command

refer