Sometimes you want to know how long it takes to execute a piece of code. This is how to do it Golang:
func main() {
start := time.Now()
// Do something time consuming
elapsed := time.Since(start)
log.Printf("Time to execute code %s", elapsed)
}
Sometimes you want to know how long it takes to execute a piece of code. This is how to do it Golang:
func main() {
start := time.Now()
// Do something time consuming
elapsed := time.Since(start)
log.Printf("Time to execute code %s", elapsed)
}