- Graphviz
sudo apt install graphviz
-
Add to main.go (Skip for scout as it's already done for you)
import ( ... baseHttp "net/http" _ "net/http/pprof" ... ) func main() { ... // DEBUG ONLY go func() { log.Println(baseHttp.ListenAndServe("localhost:6060", nil)) }() ... }
-
Run pprof
- CPU
go tool pprof -http localhost:8081 http://localhost:6060
- Memory
go tool pprof -http localhost:8081 http://localhost:6060/debug/pprof/heap
- gocv Mat
Run PROJECT with tag set: go run -tags matprofile PROJECT
go tool pprof -http localhost:8081 http://localhost:6060/debug/pprof/gocv.io/x/gocv.Mat
- SharedMat
Run PROJECT with tag set: go run -tags profile PROJECT
Seego tool pprof -http localhost:8081 http://localhost:6060/debug/pprof/github.com/jonoton/scout/sharedmat.counts
scout/main_profile.go
andscout/sharedmat/sharedmat_profile.go
for more insight
- CPU
-
The default web browser will open
-
Navigate the Web UI
Tip: The
View -> Flame Graph
is very handy