menu
Profiling Tests in Golang
Tuesday, Jun 23, 2020

To profile a test simply run:

$ go test -memprofile mem.prof -cpuprofile cpu.prof

To get the output of the memory profile into a png:

$ go tool pprof -png mem.prof

To get the output of the CPU profile into a png:

$ go tool pprof -png cpu.prof

Example of the memory profile:

Example of the CPU profile:

~
~
comments powered by Disqus