From e0e987007f928de294893e8f21bdbec750c0a10f Mon Sep 17 00:00:00 2001 From: muzi Date: Wed, 1 Apr 2020 08:42:59 +0800 Subject: [PATCH] Add prefetch elapsed time --- prefetch.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/prefetch.go b/prefetch.go index 2a1ad64..d257ad0 100644 --- a/prefetch.go +++ b/prefetch.go @@ -4,6 +4,7 @@ import ( "fmt" "os" "path" + "time" "path/filepath" "strconv" "strings" @@ -12,6 +13,7 @@ import ( ) func PrefetchImages(confImgPath string, ExhaustPath string, QUALITY string) { + var sTime = time.Now() // maximum ongoing prefetch is depending on your core of CPU log.Infof("Prefetching using %d cores", jobs) var finishChan = make(chan int, jobs) @@ -41,7 +43,8 @@ func PrefetchImages(confImgPath string, ExhaustPath string, QUALITY string) { if err != nil { log.Debug(err) } - + elapsed := time.Since(sTime) _, _ = fmt.Fprintf(os.Stdout, "Prefetch completeY(^_^)Y\n\n") + _, _ = fmt.Fprintf(os.Stdout, "Convert %d file in %s (^_^)Y\n\n", count, elapsed) }