Skip to content

Instantly share code, notes, and snippets.

@mannharleen
Last active January 7, 2020 05:27
Show Gist options
  • Save mannharleen/4ed5615de02cd89e6f16e05b75b1e077 to your computer and use it in GitHub Desktop.
Save mannharleen/4ed5615de02cd89e6f16e05b75b1e077 to your computer and use it in GitHub Desktop.
// 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment