December 2021
Intermediate to advanced
510 pages
11h 20m
English
The Go profiler is a great tool to help you understand how your program is spending CPU time. However, sometimes a program is spending time waiting for resources to be available. For example, it could be spending time waiting for a network connection or a file to be read. To help you understand those cases, Go provides another tool: the Tracer.
Similarly to the profiler, the tracer is also integrated with the testing and benchmarking features through the go test tool. Run the benchmarks again with the -trace option to create a trace:
| | $ go test -bench . -benchtime=10x -run ^$ -trace trace01.out |
| | goos: linux |
| | goarch: amd64 |
| | pkg: pragprog.com/rggo/performance/colStats |
| | Benchmark_Run-4 10 ... |
Read now
Unlock full access