util-go/benchmark/elapsed.go

14 lines
172 B
Go
Raw Normal View History

2018-09-01 03:12:54 +00:00
package benchmark
import (
"fmt"
"time"
)
func Elapsed(what string) func() {
start := time.Now()
return func() {
fmt.Printf("%s: %v", what, time.Since(start))
}
}