From 5cfd7a313fcae7c748b5bae84de779b28d4ea01b Mon Sep 17 00:00:00 2001 From: baude Date: Mon, 13 Nov 2017 12:40:21 -0600 Subject: Address run/create performance issues Fixed the logic where we observed different performance results when running an image by its fqname vs a shortname. In the case of the latter, we resolve the name without using the network. Signed-off-by: baude Closes: #37 Approved by: rhatdan --- libpod/util.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'libpod/util.go') 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) +} -- cgit v1.2.3-54-g00ecf