Forked from arsham/go_cpu_memory_profiling_benchmarks.sh
Last active
July 2, 2021 14:54
-
-
Save lggomez/ca40e44b41ec1d197bba5b3a97c6793e to your computer and use it in GitHub Desktop.
Go cpu and memory profiling benchmarks. #golang #benchmark
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Run tests for package in current location | |
| go test -run=. -bench=. -benchtime=5s -count 5 -benchmem -cpuprofile=cpu.out -memprofile=mem.out -trace=trace.out ./ | tee bench.txt | |
| go tool pprof -http :8080 cpu.out | |
| go tool pprof -http :8081 mem.out | |
| go tool trace trace.out | |
| go tool pprof $FILENAME.test cpu.out | |
| # (pprof) list <func name> | |
| # go get -u golang.org/x/perf/cmd/benchstat | |
| benchstat bench.txt | |
| rm cpu.out mem.out trace.out *.test |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment