// given package name "del" // has a function named "f1" go build -gcflags "-m -m" // profile using only Test... (NOT POSSIBLE) // benchmark results go test -run=xx -bench=. -benchmem // benchmark & profile (mem and cpu) results go test -run=xx -bench=. -benchmem -memprofile mem.prof -cpuprofile cpu.prof // pprof mem go tool pprof -alloc_space del.test mem.prof > list f1 > top10 // pprof cpu go tool pprof del.test cpu.prof > top // other references: // https://gist.github.com/arsham/bbc93990d8e5c9b54128a3d88901ab90