August 2019
Beginner to intermediate
798 pages
17h 2m
English
Go supports two kinds of profiling: CPU profiling and memory profiling. It is not recommended that you profile an application for both kinds at the same time, because these two different kinds of profiling do not work well with each other. The profileMe.go application is an exception, however, because it is used to illustrate the two techniques.
The Go code to be profiled is saved as profileMe.go, and it will be presented in five parts. The first part of profileMe.go is shown in the following Go code:
package main import ( "fmt" "math" "os" "runtime" "runtime/pprof" "time" ) func fibo1(n int) int64 { if n == 0 || n == 1 { return int64(n) } time.Sleep(time.Millisecond) return int64(fibo2(n-1)) + int64(fibo2(n-2)) ...Read now
Unlock full access