March 2020
Intermediate to advanced
406 pages
8h 39m
English
You can create both CPU and memory profiles using the go test command. This can be useful if you'd like to compare the outputs from multiple test runs. These outputs will often be stored in long-term storage for comparison over a longer date range. To execute CPU and memory profiles for a test, execute the go test -cpuprofile /tmp/cpu.prof -memprofile /tmp/mem.prof -bench command.
This will create two output files, cpu.prof and mem.prof, which will both be stored in the /tmp/ folder. These resulting profiles can be analyzed using the techniques in the Analyzing profiles section later in this chapter.
Read now
Unlock full access