summaryrefslogtreecommitdiff
path: root/libpod/util.go
diff options
context:
space:
mode:
Diffstat (limited to 'libpod/util.go')
-rw-r--r--libpod/util.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/libpod/util.go b/libpod/util.go
index 0270af07c..61546f23e 100644
--- a/libpod/util.go
+++ b/libpod/util.go
@@ -1,8 +1,10 @@
package libpod
import (
+ "fmt"
"os"
"path/filepath"
+ "time"
)
// WriteFile writes a provided string to a provided path
@@ -32,3 +34,11 @@ func StringInSlice(s string, sl []string) bool {
}
return false
}
+
+// FuncTimer helps measure the execution time of a function
+// For debug purposes, do not leave in code
+// used like defer FuncTimer("foo")
+func FuncTimer(funcName string) {
+ elapsed := time.Since(time.Now())
+ fmt.Printf("%s executed in %d ms\n", funcName, elapsed)
+}