I tried the command go test -cpuprofile cpu.out on a GO test file and it resulted in a file cpu.out which is full of many 64 bit numbers. It doesn't make any sense to me. What did the command do and what information can get I extract from cpu.out file?
Similarly go test -memprofile mem.out generated a mem.out file which also seems to make no sense to me. Help me out.
I have attached both the files.
cpu.out and mem.out
Use the output profiles in coordination with the go tool
e.g.:
go tool pprof testbin.test cpu.out
I'd recommend some func Benchmark*(b *testing.B)
implementations for functionality you're interesting in profiling.
Once in the tool try top10
:
Welcome to pprof! For help, type 'help'.
(pprof) top10
More information: https://blog.golang.org/profiling-go-programs
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With