diff options
author | baude <bbaude@redhat.com> | 2017-11-13 12:40:21 -0600 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2017-11-14 21:14:13 +0000 |
commit | 5cfd7a313fcae7c748b5bae84de779b28d4ea01b (patch) | |
tree | 310b7b4d63f989415d5dcf1696a127c2f3d0ce0a /libpod/util.go | |
parent | 7df322123290ee600812312421b98cfb97031e9f (diff) | |
download | podman-5cfd7a313fcae7c748b5bae84de779b28d4ea01b.tar.gz podman-5cfd7a313fcae7c748b5bae84de779b28d4ea01b.tar.bz2 podman-5cfd7a313fcae7c748b5bae84de779b28d4ea01b.zip |
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 <bbaude@redhat.com>
Closes: #37
Approved by: rhatdan
Diffstat (limited to 'libpod/util.go')
-rw-r--r-- | libpod/util.go | 10 |
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) +} |