March 2020
Intermediate to advanced
406 pages
8h 39m
English
One of the really nice features of profiling is that you can compare profiles with one another. If we have two separate measurements from the same program, we can determine whether or not the change we made is having a positive impact on the system. Let's augment our HTTP sleep timing function a little bit:
package mainimport ( "fmt" "net/http" _ "net/http/pprof" "strconv" "time")
func main() { Handler := func(w http.ResponseWriter, r *http.Request) { sleepDuration := r.URL.Query().Get("time") sleepDurationInt, err := strconv.Atoi(sleepDuration) if err != nil { fmt.Println("Incorrect value passed as a ...Read now
Unlock full access