Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

Program Profiling

Farshid Tavakolizadeh edited this page May 19, 2020 · 1 revision

The program profiling can be enabled by setting --profile argument. Once enabled, an HTTP runtime profiling server will bind to the given port.

The profile can be analysed with go pprof tool. E.g:

go tool pprof <service-catalog-executable-path> http://<host>:<profile-port>/debug/pprof/<profile_type>

Add --http localhost:<port> to get an interactive web UI locally at the given port.

The list of profile types are available here: https://golang.org/pkg/runtime/pprof/#Profile

For example, to get the CPU profile for 60 seconds:

go tool pprof --http localhost:8888 --seconds 60 ./service-catalog-linux-amd64 http://example.com:6060/debug/pprof/profile

For more information regarding pprof, visit: https://blog.golang.org/profiling-go-programs

Clone this wiki locally